mlog

package
v5.6.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2018 License: AGPL-3.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var Any = zap.Any
View Source
var Bool = zap.Bool
View Source
var Err = zap.Error
View Source
var Int = zap.Int
View Source
var Int64 = zap.Int64
View Source
var String = zap.String
View Source
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 Field

type Field = zapcore.Field

Type and function aliases from zap to limit the libraries scope into MM code

type LogFunc

type LogFunc func(string, ...Field)
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 (*Logger) ChangeLevels

func (l *Logger) ChangeLevels(config *LoggerConfiguration)

func (*Logger) Critical

func (l *Logger) Critical(message string, fields ...Field)

func (*Logger) Debug

func (l *Logger) Debug(message string, fields ...Field)

func (*Logger) Error

func (l *Logger) Error(message string, fields ...Field)

func (*Logger) Info

func (l *Logger) Info(message string, fields ...Field)

func (*Logger) SetConsoleLevel

func (l *Logger) SetConsoleLevel(level string)

func (*Logger) StdLog

func (l *Logger) StdLog(fields ...Field) *log.Logger

func (*Logger) StdLogWriter

func (l *Logger) StdLogWriter() io.Writer

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) Warn

func (l *Logger) Warn(message string, fields ...Field)

func (*Logger) With

func (l *Logger) With(fields ...Field) *Logger

func (*Logger) WithCallerSkip

func (l *Logger) WithCallerSkip(skip int) *Logger

type LoggerConfiguration

type LoggerConfiguration struct {
	EnableConsole bool
	ConsoleJson   bool
	ConsoleLevel  string
	EnableFile    bool
	FileJson      bool
	FileLevel     string
	FileLocation  string
}

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{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL