Documentation ¶
Index ¶
- func GetCaller() *runtime.Frame
- type CustomGraylogHook
- type Logger
- type LoggerBuilderFn
- type Logrus
- func (l *Logrus) Bool(key string, val bool)
- func (l *Logrus) Clone() Logger
- func (l *Logrus) Debug(msg string, attrMap map[string]interface{})
- func (l *Logrus) Err(err error, msg string, attrMap map[string]interface{})
- func (l *Logrus) F64(key string, val float64)
- func (l *Logrus) Fatal(msg string, attrMap map[string]interface{})
- func (l *Logrus) I64(key string, val int64)
- func (l *Logrus) Info(msg string, attrMap map[string]interface{})
- func (l *Logrus) Panic(msg string, attrMap map[string]interface{})
- func (l *Logrus) SetAttrs(attrMap map[string]interface{})
- func (l *Logrus) Str(key, val string)
- func (l *Logrus) Warn(msg string, attrMap map[string]interface{})
- type LogrusConf
- type MultiLogger
- func (l *MultiLogger) Bool(key string, val bool)
- func (l *MultiLogger) Clone() Logger
- func (l *MultiLogger) Debug(msg string, attrMap map[string]interface{})
- func (l *MultiLogger) Err(err error, msg string, attrMap map[string]interface{})
- func (l *MultiLogger) F64(key string, val float64)
- func (l *MultiLogger) Fatal(msg string, attrMap map[string]interface{})
- func (l *MultiLogger) I64(key string, val int64)
- func (l *MultiLogger) Info(msg string, attrMap map[string]interface{})
- func (l *MultiLogger) Panic(msg string, attrMap map[string]interface{})
- func (l *MultiLogger) SetAttrs(attrMap map[string]interface{})
- func (l *MultiLogger) Str(key, val string)
- func (l *MultiLogger) Warn(msg string, attrMap map[string]interface{})
- type NopLogger
- func (nl *NopLogger) Bool(key string, val bool)
- func (nl *NopLogger) Clone() Logger
- func (nl *NopLogger) Debug(msg string, attrMap map[string]interface{})
- func (nl *NopLogger) Err(err error, msg string, attrMap map[string]interface{})
- func (nl *NopLogger) F64(key string, val float64)
- func (nl *NopLogger) Fatal(msg string, attrMap map[string]interface{})
- func (nl *NopLogger) I64(key string, val int64)
- func (nl *NopLogger) Info(msg string, attrMap map[string]interface{})
- func (nl *NopLogger) Panic(msg string, attrMap map[string]interface{})
- func (nl *NopLogger) SetAttrs(attrMap map[string]interface{})
- func (nl *NopLogger) Str(key, val string)
- func (nl *NopLogger) Warn(msg string, attrMap map[string]interface{})
- type NopLoggerMsg
- type SentryConf
- type SentryLogger
- func (l *SentryLogger) Bool(key string, val bool)
- func (l *SentryLogger) Clone() Logger
- func (l *SentryLogger) Debug(msg string, attrMap map[string]interface{})
- func (l *SentryLogger) Err(err error, msg string, attrMap map[string]interface{})
- func (l *SentryLogger) F64(key string, val float64)
- func (l *SentryLogger) Fatal(msg string, attrMap map[string]interface{})
- func (l *SentryLogger) I64(key string, val int64)
- func (l *SentryLogger) Info(msg string, attrMap map[string]interface{})
- func (l *SentryLogger) Panic(msg string, attrMap map[string]interface{})
- func (l *SentryLogger) Req(req *http.Request) Logger
- func (l *SentryLogger) SetAttrs(attrMap map[string]interface{})
- func (l *SentryLogger) Str(key, val string)
- func (l *SentryLogger) Warn(msg string, attrMap map[string]interface{})
- type SentryLoggerMsg
- func (m *SentryLoggerMsg) Bool(key string, val bool)
- func (m *SentryLoggerMsg) F64(key string, val float64)
- func (m *SentryLoggerMsg) I64(key string, val int64)
- func (m *SentryLoggerMsg) Send()
- func (m *SentryLoggerMsg) SetAttrs(attrMap map[string]interface{})
- func (m *SentryLoggerMsg) Str(key, val string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CustomGraylogHook ¶
type CustomGraylogHook struct { *graylog.GraylogHook // contains filtered or unexported fields }
CustomGraylogHook adds a new layer over gemnasium Graylog hook to handle specific cases when trigerred.
func NewCustomGraylogHook ¶
func NewCustomGraylogHook(addr, fieldPrefix string) *CustomGraylogHook
NewCustomGraylogHook creates a hook to be added to an instance of logger.
type Logger ¶
type Logger interface { attrs.Attributable // Debug logs a message with the debug level // the attributes passed as parameters are used only // for the sent meessage. Debug(msg string, attrs map[string]interface{}) // Info logs a message with the info level // the attributes passed as parameters are used only // for the sent meessage. Info(msg string, attrs map[string]interface{}) // Err logs a message with the error level // the attributes passed as parameters are used only // for the sent meessage. Err(err error, msg string, attrs map[string]interface{}) // Warn logs a message with the warn level // the attributes passed as parameters are used only // for the sent meessage. Warn(msg string, attrs map[string]interface{}) // Fatal logs a message with the fatal level // the attributes passed as parameters are used only // for the sent meessage. Fatal(msg string, attrs map[string]interface{}) // Panic logs a message with the panic level // the attributes passed as parameters are used only // for the sent meessage. Panic(msg string, attrs map[string]interface{}) // Clone a logger, so from that attributes // will not be shared anymore. Clone() Logger }
Logger defines the interface to log data. Most of the calls return the same Logger interface so we can easily chain calls, like l.Str("foo", "bar").I64("count", 3).Trace("blab").
type LoggerBuilderFn ¶
type LoggerBuilderFn func() Logger
LoggerBuilderFn is the type required to instantiate a new Logger.
func NewLogrusBuilder ¶
func NewLogrusBuilder(conf *LogrusConf) (LoggerBuilderFn, func(), error)
NewLogrusBuilder returns a function to create Logrus loggers
func NewMultiLoggerBuilder ¶
func NewMultiLoggerBuilder(wrappedFns ...LoggerBuilderFn) LoggerBuilderFn
NewMultiLoggerBuilder returns a function to create MultiLogger loggers.
func NewNopLoggerBuilder ¶
func NewNopLoggerBuilder() LoggerBuilderFn
NewNopLoggerBuilder returns a function to construct NopLogger.
func NewSentryBuilder ¶
func NewSentryBuilder(conf *SentryConf) (LoggerBuilderFn, func(), error)
NewSentryBuilder returns a function to create Sentry loggers.
type Logrus ¶
type Logrus struct {
// contains filtered or unexported fields
}
Logrus is the logger to work with logrus.
type LogrusConf ¶
type LogrusConf struct { // OutFileName is the file were we want to output the logs. OutFileName string // GraylogHost if not empty will report directly to graylog. GraylogHost string // GraylogFieldPrefix to add a prefix to all graylog logs. GraylogFieldPrefix string }
LogrusConf contains the values to configure a Logrus parser.
type MultiLogger ¶
type MultiLogger struct {
// contains filtered or unexported fields
}
MultiLogger is a logger that can wrap several other loggers an send the logs those multiple other instances.
func NewMultiLogger ¶
func NewMultiLogger(wrapped ...Logger) *MultiLogger
NewMultiLogger crates a new logger that will forward log messages to the list of wrapped loggers.
func (*MultiLogger) Bool ¶
func (l *MultiLogger) Bool(key string, val bool)
Bool adds a tag to the logger of type bool
func (*MultiLogger) Debug ¶
func (l *MultiLogger) Debug(msg string, attrMap map[string]interface{})
Debug logs a message with the debug level
func (*MultiLogger) Err ¶
func (l *MultiLogger) Err(err error, msg string, attrMap map[string]interface{})
Err logs a message with the error level
func (*MultiLogger) F64 ¶
func (l *MultiLogger) F64(key string, val float64)
F64 adds a tag to the logger of type float64
func (*MultiLogger) Fatal ¶
func (l *MultiLogger) Fatal(msg string, attrMap map[string]interface{})
Fatal logs a message with the fatal level
func (*MultiLogger) I64 ¶
func (l *MultiLogger) I64(key string, val int64)
I64 adds a tag to the logger of type int64
func (*MultiLogger) Info ¶
func (l *MultiLogger) Info(msg string, attrMap map[string]interface{})
Info logs a message with the info level
func (*MultiLogger) Panic ¶
func (l *MultiLogger) Panic(msg string, attrMap map[string]interface{})
Panic logs a message with the fatal level
func (*MultiLogger) SetAttrs ¶
func (l *MultiLogger) SetAttrs(attrMap map[string]interface{})
Labels sets labels for a logger in a batch
func (*MultiLogger) Str ¶
func (l *MultiLogger) Str(key, val string)
Str adds a tag to the logger of type string
func (*MultiLogger) Warn ¶
func (l *MultiLogger) Warn(msg string, attrMap map[string]interface{})
Warn logs a message with the warn level
type NopLogger ¶
type NopLogger struct { }
NopLogger is a logger that logs nothing.
func NewNopLogger ¶
func NewNopLogger() *NopLogger
NewNopLogger is a function to construct a NopLogger logger.
type NopLoggerMsg ¶
type NopLoggerMsg struct { }
NopLoggerMsg is a log message that will send nothing.
type SentryConf ¶
type SentryConf struct { Dsn string `json:"dsn"` AttachStacktrace bool `json:"attach_stacktrace"` SampleRate float64 `json:"sample_rate"` Release string `json:"release"` Environment string `json:"environment"` FlushTimeoutSecs int `json:"flush_timeout_secs` LevelThreshold string `json:"level_threshold"` // the mininimum level required to be sent AllowedTags []string }
SentryConf contains the values to initialize a Sentry logger.
type SentryLogger ¶
type SentryLogger struct {
// contains filtered or unexported fields
}
SentryLogger implements a logger that sends messages to Sentry.
func (*SentryLogger) Bool ¶
func (l *SentryLogger) Bool(key string, val bool)
Bool adds a tag to the logger of type bool
func (*SentryLogger) Debug ¶
func (l *SentryLogger) Debug(msg string, attrMap map[string]interface{})
Debug logs a message with the debug level
func (*SentryLogger) Err ¶
func (l *SentryLogger) Err(err error, msg string, attrMap map[string]interface{})
Err logs a message with the error level
func (*SentryLogger) F64 ¶
func (l *SentryLogger) F64(key string, val float64)
F64 adds a tag to the logger of type float64
func (*SentryLogger) Fatal ¶
func (l *SentryLogger) Fatal(msg string, attrMap map[string]interface{})
Fatal logs a message with the fatal level
func (*SentryLogger) I64 ¶
func (l *SentryLogger) I64(key string, val int64)
I64 adds a tag to the logger of type int64
func (*SentryLogger) Info ¶
func (l *SentryLogger) Info(msg string, attrMap map[string]interface{})
Info logs a message with the info level
func (*SentryLogger) Panic ¶
func (l *SentryLogger) Panic(msg string, attrMap map[string]interface{})
Panic logs a message with the fatal level
func (*SentryLogger) Req ¶
func (l *SentryLogger) Req(req *http.Request) Logger
Req prepares a log to include http request information.
func (*SentryLogger) SetAttrs ¶
func (l *SentryLogger) SetAttrs(attrMap map[string]interface{})
Labels sets labels for a logger in a batch
func (*SentryLogger) Str ¶
func (l *SentryLogger) Str(key, val string)
Str adds a tag to the logger of type string
func (*SentryLogger) Warn ¶
func (l *SentryLogger) Warn(msg string, attrMap map[string]interface{})
Warn logs a message with the warn level
type SentryLoggerMsg ¶
type SentryLoggerMsg struct {
// contains filtered or unexported fields
}
SentryLoggerMsg implements a LogMessage that can be sent to Sentry.
func (*SentryLoggerMsg) Bool ¶
func (m *SentryLoggerMsg) Bool(key string, val bool)
Bool adds a tag to the message of type bool.
func (*SentryLoggerMsg) F64 ¶
func (m *SentryLoggerMsg) F64(key string, val float64)
F64 adds a tag to the message of type float64.
func (*SentryLoggerMsg) I64 ¶
func (m *SentryLoggerMsg) I64(key string, val int64)
I64 adds a tag to the message of type int64.
func (*SentryLoggerMsg) Send ¶
func (m *SentryLoggerMsg) Send()
Send the message that has been constructed.
func (*SentryLoggerMsg) SetAttrs ¶
func (m *SentryLoggerMsg) SetAttrs(attrMap map[string]interface{})
func (*SentryLoggerMsg) Str ¶
func (m *SentryLoggerMsg) Str(key, val string)
Str adds a tag to the message of type string.