Documentation ¶
Index ¶
- Constants
- Variables
- func GloballyDisableDebugLogForTest()
- func GloballyEnableDebugLogForTest()
- func InitGlobalLogger(logger *Logger)
- func RedirectStdLog(logger *Logger)
- type Field
- type LogFunc
- type Logger
- func (l *Logger) ChangeLevels(config *LoggerConfiguration)
- func (l *Logger) Critical(message string, fields ...Field)
- func (l *Logger) Debug(message string, fields ...Field)
- func (l *Logger) Error(message string, fields ...Field)
- func (l *Logger) Info(message string, fields ...Field)
- func (l *Logger) SetConsoleLevel(level string)
- func (l *Logger) StdLog(fields ...Field) *log.Logger
- func (l *Logger) StdLogAt(level string, fields ...Field) (*log.Logger, error)
- func (l *Logger) StdLogWriter() io.Writer
- func (l *Logger) Sugar() *SugarLogger
- func (l *Logger) Warn(message string, fields ...Field)
- func (l *Logger) With(fields ...Field) *Logger
- func (l *Logger) WithCallerSkip(skip int) *Logger
- type LoggerConfiguration
- type SugarLogger
Constants ¶
const ( // Very verbose messages for debugging specific issues LevelDebug = "debug" // Default log level, informational LevelInfo = "info" // Warnings are messages about possible issues LevelWarn = "warn" // Errors are messages about things we know are problems LevelError = "error" )
Variables ¶
var Any = zap.Any
var Bool = zap.Bool
var Duration = zap.Duration
var Err = zap.Error
var Int = zap.Int
var Int32 = zap.Int32
var Int64 = zap.Int64
var NamedErr = zap.NamedError
var String = zap.String
var Uint32 = zap.Uint32
Functions ¶
func GloballyDisableDebugLogForTest ¶
func GloballyDisableDebugLogForTest()
DON'T USE THIS Modify the level on the app logger
func GloballyEnableDebugLogForTest ¶
func GloballyEnableDebugLogForTest()
DON'T USE THIS Modify the level on the app logger
func InitGlobalLogger ¶
func InitGlobalLogger(logger *Logger)
func RedirectStdLog ¶
func RedirectStdLog(logger *Logger)
Types ¶
type LogFunc ¶
var Critical LogFunc = defaultCriticalLog
var Debug LogFunc = defaultDebugLog
var Error LogFunc = defaultErrorLog
var Info LogFunc = defaultInfoLog
var Warn LogFunc = defaultWarnLog
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func NewLogger ¶
func NewLogger(config *LoggerConfiguration) *Logger
func NewTestingLogger ¶
NewTestingLogger creates a Logger that proxies logs through a testing interface. This allows tests that spin up App instances to avoid spewing logs unless the test fails or -verbose is specified.
func (*Logger) ChangeLevels ¶
func (l *Logger) ChangeLevels(config *LoggerConfiguration)
func (*Logger) SetConsoleLevel ¶
func (*Logger) StdLogAt ¶
StdLogAt returns *log.Logger which writes to supplied zap logger at required level.
func (*Logger) StdLogWriter ¶
StdLogWriter returns a writer that can be hooked up to the output of a golang standard logger anything written will be interpreted as log entries accordingly
func (*Logger) Sugar ¶
func (l *Logger) Sugar() *SugarLogger
Made for the plugin interface, wraps mlog in a simpler interface at the cost of performance
func (*Logger) WithCallerSkip ¶
type LoggerConfiguration ¶
type SugarLogger ¶
type SugarLogger struct {
// contains filtered or unexported fields
}
Made for the plugin interface, use the regular logger for other uses
func (*SugarLogger) Debug ¶
func (l *SugarLogger) Debug(msg string, keyValuePairs ...interface{})
func (*SugarLogger) Error ¶
func (l *SugarLogger) Error(msg string, keyValuePairs ...interface{})
func (*SugarLogger) Info ¶
func (l *SugarLogger) Info(msg string, keyValuePairs ...interface{})
func (*SugarLogger) Warn ¶
func (l *SugarLogger) Warn(msg string, keyValuePairs ...interface{})