Documentation ¶
Index ¶
- Constants
- func Alert(args ...interface{})
- func Alertf(format string, args ...interface{})
- func ContextWithEntry(e Entry, ctx context.Context) context.Context
- func Critical(args ...interface{})
- func Criticalf(format string, args ...interface{})
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Emergency(args ...interface{})
- func Emergencyf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func NewLoggerFactory(level Level, opts ...opt) *factory
- func Notice(args ...interface{})
- func Noticef(format string, args ...interface{})
- func SetDefaultEntry(entry Entry)
- func SetOut(out io.Writer) opt
- func Warning(args ...interface{})
- func Warningf(format string, args ...interface{})
- type Entry
- type Factory
- type Fields
- type JsonFormatter
- type Level
Constants ¶
View Source
const ( // FormatVersion log format version FormatVersion uint8 = 2 // MessageLength max length of message MessageLength = 128 )
View Source
const ( FieldVersion = "@version" FieldTimestamp = "@timestamp" FieldLevel = "level" FieldContent = "content" FieldMessage = "message" FieldUserId = "userId" FieldTraceId = "traceId" FieldRequestId = "context-id" )
Variables ¶
This section is empty.
Functions ¶
func ContextWithEntry ¶
ContextWithEntry set entry to context
func Emergencyf ¶
func Emergencyf(format string, args ...interface{})
func NewLoggerFactory ¶
func NewLoggerFactory(level Level, opts ...opt) *factory
NewLoggerProvider returns logger provider
Types ¶
type Entry ¶
type Entry interface { Info(args ...interface{}) Debug(args ...interface{}) Notice(args ...interface{}) Warning(args ...interface{}) Alert(args ...interface{}) Error(args ...interface{}) Emergency(args ...interface{}) Critical(args ...interface{}) Infof(format string, args ...interface{}) Debugf(format string, args ...interface{}) Noticef(format string, args ...interface{}) Warningf(format string, args ...interface{}) Alertf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Emergencyf(format string, args ...interface{}) Criticalf(format string, args ...interface{}) WithField(key string, value interface{}) Entry WithFields(fields Fields) Entry GetFields() Fields }
func EntryFromContext ¶
EntryFromContext get entry from context
func EntryFromContextOrDefault ¶
EntryFromContextOrDefault returns the logger from context if not nil, otherwise, returns default entry
func WithFields ¶
WithFields returns copy of default entry with fields
type JsonFormatter ¶
type JsonFormatter struct{}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.