Documentation
¶
Index ¶
Constants ¶
const FieldReplay = "replayed-from-level"
FieldReplay is a field assigned to a message that has been replayed at a different log level. Its value is equal to the original log level.
const FieldRollup = "rollup-multiplicity"
FieldRollup is a field assigned to the last message in a window. Its value is equal to the number of messages in the window before it was flushed.
Variables ¶
var ( ErrIllegalLevel = fmt.Errorf("illegal log level") ErrIllegalEncoding = fmt.Errorf("illegal log encoding") )
Functions ¶
func LogEmergencyError ¶
func LogEmergencyErrors ¶
Types ¶
type Config ¶
type Config struct { LogLevel string `env:"log_level" file:"log_level" default:"info"` LogEncoding string `env:"log_encoding" file:"log_encoding" default:"console"` LogColorize bool `env:"log_colorize" file:"log_colorize" default:"true"` LogJSONFieldNames map[string]string `env:"log_json_field_names" file:"log_json_field_names"` LogInitialFields Fields `env:"log_fields" file:"log_fields"` LogShortTime bool `env:"log_short_time" file:"log_short_time" default:"false"` LogDisplayFields bool `env:"log_display_fields" file:"log_display_fields" default:"true"` LogDisplayMultilineFields bool `env:"log_display_multiline_fields" file:"log_display_multiline_fields" default:"false"` RawLogFieldBlacklist string `env:"log_field_blacklist" file:"log_field_blacklist" mask:"true"` LogFieldBlacklist []string }
type GomolShim ¶
type GomolShim struct {
// contains filtered or unexported fields
}
func (*GomolShim) LogWithFields ¶
func (*GomolShim) WithFields ¶
type Logger ¶
type Logger interface { WithFields(Fields) Logger LogWithFields(LogLevel, Fields, string, ...interface{}) Sync() error // Convenience Methods Debug(string, ...interface{}) Info(string, ...interface{}) Warning(string, ...interface{}) Error(string, ...interface{}) Fatal(string, ...interface{}) DebugWithFields(Fields, string, ...interface{}) InfoWithFields(Fields, string, ...interface{}) WarningWithFields(Fields, string, ...interface{}) ErrorWithFields(Fields, string, ...interface{}) FatalWithFields(Fields, string, ...interface{}) }
func EmergencyLogger ¶
func EmergencyLogger() Logger
func InitGomolShim ¶
func NewGomolLogger ¶
func NewGomolLogger(logger *gomol.LogAdapter, initialFields Fields) Logger
func NewNilLogger ¶
func NewNilLogger() Logger
func NewRollupAdapter ¶
NewRollupAdapter returns a logger with functionality to throttle similar messages. Messages begin a roll-up when a second messages with an identical format string is seen in the same window period. All remaining messages logged within that period are captured and emitted as a single message at the end of the window period. The fields and args are equal to the first rolled-up message.
type ReplayLogger ¶
type ReplayLogger interface { Logger // Replay will cause all of the messages previously logged at one of the // journaled levels to be re-set at the given level. All future messages // logged at one of the journaled levels will be replayed immediately. Replay(LogLevel) }
ReplayLogger is a Logger that provides a way to replay a sequence of message in the order they were logged, at a higher log level.
func NewReplayAdapter ¶
func NewReplayAdapter(logger Logger, levels ...LogLevel) ReplayLogger
NewReplayAdapter creates a ReplayLogger wrapping the given logger.