Documentation ¶
Index ¶
- Variables
- func DisableTracing()
- func EnableTracing()
- func End(t *Message)
- func InitLogger(cfg *log.LoggingConfig) error
- type Entry
- type Message
- type Operation
- func FromContext(ctx context.Context, message string, args ...interface{}) Operation
- func FromOperation(parent Operation, format string, args ...interface{}) Operation
- func NewOperation(ctx context.Context, format string, args ...interface{}) Operation
- func NewOperationWithLoggerFrom(ctx context.Context, oldOp Operation, format string, args ...interface{}) Operationdeprecated
- func WithCancel(parent *Operation, format string, args ...interface{}) (Operation, context.CancelFunc)
- func WithDeadline(parent *Operation, expiration time.Time, format string, args ...interface{}) (Operation, context.CancelFunc)
- func WithTimeout(parent *Operation, timeout time.Duration, format string, args ...interface{}) (Operation, context.CancelFunc)
- func WithValue(parent *Operation, key, val interface{}, format string, args ...interface{}) Operation
- func (o *Operation) Debug(args ...interface{})
- func (o *Operation) Debugf(format string, args ...interface{})
- func (o Operation) Err() error
- func (o *Operation) Error(args ...interface{})
- func (o *Operation) Errorf(format string, args ...interface{})
- func (o *Operation) Fatal(args ...interface{})
- func (o *Operation) Fatalf(format string, args ...interface{})
- func (o *Operation) ID() string
- func (o *Operation) Info(args ...interface{})
- func (o *Operation) Infof(format string, args ...interface{})
- func (o *Operation) Panic(args ...interface{})
- func (o *Operation) Panicf(format string, args ...interface{})
- func (o Operation) String() string
- func (o *Operation) Warn(args ...interface{})
- func (o *Operation) Warnf(format string, args ...interface{})
- func (o *Operation) WithFields(fields logrus.Fields) *Entry
- type OperationKey
Constants ¶
This section is empty.
Variables ¶
var Logger = &logrus.Logger{ Out: os.Stderr, Formatter: log.NewTextFormatter(), Hooks: make(logrus.LevelHooks), Level: logrus.InfoLevel, }
Functions ¶
func InitLogger ¶
func InitLogger(cfg *log.LoggingConfig) error
Add Syslog hook This method is not thread safe, this is currently not a problem because it is only called once from main
Types ¶
type Entry ¶
type Entry struct { // Contains all the fields set by the user. Data logrus.Fields // contains filtered or unexported fields }
Entry is like logrus.Entry, but for Operation. Functionality is added as needed.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
trace object used to grab run-time state
type Operation ¶
type Operation struct { context.Context // Logger is used to configure an Operation-specific destination for log messages, in addition // to the global logger. This logger is passed to any children which are created. Logger *logrus.Logger // contains filtered or unexported fields }
func FromContext ¶
FromContext will return an Operation
The Operation returned will be one of the following:
The operation in the context value The operation passed as the context param A new operation
func FromOperation ¶
FromOperation creates a child operation from the one supplied uses the same context as the parent
func NewOperation ¶
NewOperation will return a new operation with operationID added as a value to the context
func NewOperationWithLoggerFrom
deprecated
func NewOperationWithLoggerFrom(ctx context.Context, oldOp Operation, format string, args ...interface{}) Operation
NewOperationWithLoggerFrom will return a new operation with operationID added as a value to the context and logging settings copied from the supplied operation.
Deprecated: This method was added to aid in converting old code to use operation-based logging.
Its use almost always indicates a broken context/operation model (e.g., a context being improperly stored in a struct instead of being passed between functions).
func WithCancel ¶
func WithCancel(parent *Operation, format string, args ...interface{}) (Operation, context.CancelFunc)
WithCancel creates a new operation from parent with context.WithCancel
func WithDeadline ¶
func WithDeadline(parent *Operation, expiration time.Time, format string, args ...interface{}) (Operation, context.CancelFunc)
WithDeadline creates a new operation from parent with context.WithDeadline
func WithTimeout ¶
func WithTimeout(parent *Operation, timeout time.Duration, format string, args ...interface{}) (Operation, context.CancelFunc)
WithTimeout creates a new operation from parent with context.WithTimeout
func WithValue ¶
func WithValue(parent *Operation, key, val interface{}, format string, args ...interface{}) Operation
WithValue creates a new operation from parent with context.WithValue