Documentation
¶
Index ¶
- Variables
- func ConfigureCustomLogger(lvl Level, fmt Format, out io.Writer) *zerolog.Logger
- func ConfigureGlobalLogger(lvl Level, fmt Format) *zerolog.Logger
- func Debug() *zerolog.Event
- func Error() *zerolog.Event
- func Fatal() *zerolog.Event
- func Info() *zerolog.Event
- func Logger() *zerolog.Logger
- func Panic() *zerolog.Event
- func SendToStdout(output string)
- func Warn() *zerolog.Event
- type ContextualLogger
- func (cl *ContextualLogger) Append(keyValues ...interface{}) error
- func (cl *ContextualLogger) CreateFromContext(keyValues ...interface{}) (*ContextualLogger, error)
- func (cl *ContextualLogger) Debug() *zerolog.Event
- func (cl *ContextualLogger) Error() *zerolog.Event
- func (cl *ContextualLogger) ErrorLine() *zerolog.Event
- func (cl *ContextualLogger) ErrorLineC(skippedStackFrames int) *zerolog.Event
- func (cl *ContextualLogger) Fatal() *zerolog.Event
- func (cl *ContextualLogger) GetContexts() []interface{}
- func (cl *ContextualLogger) Info() *zerolog.Event
- func (cl *ContextualLogger) MustAppend(keyValues ...interface{})
- func (cl *ContextualLogger) MustCreateFromContext(keyValues ...interface{}) *ContextualLogger
- func (cl *ContextualLogger) Panic() *zerolog.Event
- func (cl *ContextualLogger) Warn() *zerolog.Event
- type Format
- type Level
- type StringWriter
Constants ¶
This section is empty.
Variables ¶
var ( // InfoEnabled - check if this level is enabled InfoEnabled bool // DebugEnabled - check if this level is enabled DebugEnabled bool // WarnEnabled - check if this level is enabled WarnEnabled bool // ErrorEnabled - check if this level is enabled ErrorEnabled bool // FatalEnabled - check if this level is enabled FatalEnabled bool // PanicEnabled - check if this level is enabled PanicEnabled bool // ErrWrongNumberOfArgs ... ErrWrongNumberOfArgs error = errors.New("the number of arguments must be even") )
Functions ¶
func ConfigureCustomLogger ¶ added in v1.0.3
ConfigureCustomLogger - configures the logger globally
func ConfigureGlobalLogger ¶
ConfigureGlobalLogger - configures the logger globally
func SendToStdout ¶
func SendToStdout(output string)
SendToStdout - logs a output with no log format
Types ¶
type ContextualLogger ¶
type ContextualLogger struct {
// contains filtered or unexported fields
}
ContextualLogger - a struct containing all valid event loggers (each one can be null if not enabled)
func CreateContextualLogger ¶
func CreateContextualLogger(keyValues ...interface{}) *ContextualLogger
CreateContextualLogger - creates loggers with context
func (*ContextualLogger) Append ¶ added in v1.0.3
func (cl *ContextualLogger) Append(keyValues ...interface{}) error
Append - appends more context
func (*ContextualLogger) CreateFromContext ¶ added in v1.0.4
func (cl *ContextualLogger) CreateFromContext(keyValues ...interface{}) (*ContextualLogger, error)
CreateFromContext - creates a new logger context from this context
func (*ContextualLogger) Debug ¶
func (cl *ContextualLogger) Debug() *zerolog.Event
Debug - returns the event logger using the configured context
func (*ContextualLogger) Error ¶
func (cl *ContextualLogger) Error() *zerolog.Event
Error - returns the event logger using the configured context
func (*ContextualLogger) ErrorLine ¶ added in v1.0.5
func (cl *ContextualLogger) ErrorLine() *zerolog.Event
ErrorLine - returns the event logger using the configured context
func (*ContextualLogger) ErrorLineC ¶ added in v1.0.6
func (cl *ContextualLogger) ErrorLineC(skippedStackFrames int) *zerolog.Event
ErrorLineC - returns the event logger using the configured context
func (*ContextualLogger) Fatal ¶
func (cl *ContextualLogger) Fatal() *zerolog.Event
Fatal - returns the event logger using the configured context
func (*ContextualLogger) GetContexts ¶ added in v1.0.3
func (cl *ContextualLogger) GetContexts() []interface{}
GetContexts - returns the logger contexts
func (*ContextualLogger) Info ¶
func (cl *ContextualLogger) Info() *zerolog.Event
Info - returns the event logger using the configured context
func (*ContextualLogger) MustAppend ¶ added in v1.0.6
func (cl *ContextualLogger) MustAppend(keyValues ...interface{})
MustAppend - appends more context, panics if any error is founbd
func (*ContextualLogger) MustCreateFromContext ¶ added in v1.0.4
func (cl *ContextualLogger) MustCreateFromContext(keyValues ...interface{}) *ContextualLogger
MustCreateFromContext - creates a new logger context from this context, raises panic if some error
func (*ContextualLogger) Panic ¶
func (cl *ContextualLogger) Panic() *zerolog.Event
Panic - returns the event logger using the configured context
func (*ContextualLogger) Warn ¶
func (cl *ContextualLogger) Warn() *zerolog.Event
Warn - returns the event logger using the configured context
type Level ¶
type Level string
Level - type
const ( // INFO - log level INFO Level = "info" // DEBUG - log level DEBUG Level = "debug" // WARN - log level WARN Level = "warn" // ERROR - log level ERROR Level = "error" // FATAL - log level FATAL Level = "fatal" // PANIC - log level PANIC Level = "panic" // NONE - log level NONE Level = "none" // SILENT - log level SILENT Level = "silent" )
type StringWriter ¶ added in v1.0.6
type StringWriter struct {
// contains filtered or unexported fields
}
StringWriter - writes in memory
func NewStringWriter ¶ added in v1.0.3
func NewStringWriter(size uint64) *StringWriter
func (*StringWriter) Bytes ¶ added in v1.0.6
func (sb *StringWriter) Bytes() []byte
Bytes - return the stored bytes
func (*StringWriter) Reset ¶ added in v1.0.6
func (sb *StringWriter) Reset()
Write - implements the io.Writer interface