Documentation ¶
Index ¶
- func AddRequestID(ctx context.Context, fields loggo.Fields) loggo.Fields
- func F(args ...interface{}) (res map[string]interface{})
- func GetFields(ctx context.Context) (fields loggo.Fields)
- func NoCodeFormat(entry loggo.Entry) string
- func SetLevel(level Level)
- type BasicLogger
- type EmptyLogger
- func (EmptyLogger) Debug(format string, args ...interface{})
- func (EmptyLogger) Debugf(format string, args ...interface{})
- func (EmptyLogger) Error(format string, args ...interface{})
- func (EmptyLogger) Errorf(format string, args ...interface{})
- func (EmptyLogger) Info(format string, args ...interface{})
- func (EmptyLogger) Infof(format string, args ...interface{})
- func (EmptyLogger) StCritical(message string, fields loggo.Fields)
- func (EmptyLogger) StDebug(message string, fields loggo.Fields)
- func (EmptyLogger) StError(message string, fields loggo.Fields)
- func (EmptyLogger) StInfo(message string, fields loggo.Fields)
- func (EmptyLogger) StTrace(message string, fields loggo.Fields)
- func (EmptyLogger) StWarning(message string, fields loggo.Fields)
- func (EmptyLogger) Trace(format string, args ...interface{})
- func (EmptyLogger) Tracef(format string, args ...interface{})
- func (EmptyLogger) Warning(format string, args ...interface{})
- func (EmptyLogger) Warningf(format string, args ...interface{})
- type Level
- type Logger
- type StLogger
- type StandardLogger
- type StructuredLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddRequestID ¶
AddRequestID adds the request Id to fields if one is there
func F ¶
func F(args ...interface{}) (res map[string]interface{})
F generates a map using a key-value pairs as arguments for example, if given arguments are "key" and 1 will return map[string]interface{}{"key": 1} PS: will not add key if the value is missing
func NoCodeFormat ¶
NoCodeFormat will remove the code reference from msg
Types ¶
type BasicLogger ¶
type BasicLogger interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warningf(format string, args ...interface{}) Errorf(format string, args ...interface{}) }
BasicLogger basic logger interface
type EmptyLogger ¶
type EmptyLogger struct{}
EmptyLogger empty logger (does nothing)
func (EmptyLogger) Debug ¶
func (EmptyLogger) Debug(format string, args ...interface{})
Debug nothing
func (EmptyLogger) Debugf ¶
func (EmptyLogger) Debugf(format string, args ...interface{})
Debugf nothing
func (EmptyLogger) Error ¶
func (EmptyLogger) Error(format string, args ...interface{})
Error nothing
func (EmptyLogger) Errorf ¶
func (EmptyLogger) Errorf(format string, args ...interface{})
Errorf nothing
func (EmptyLogger) Infof ¶
func (EmptyLogger) Infof(format string, args ...interface{})
Infof nothing
func (EmptyLogger) StCritical ¶
func (EmptyLogger) StCritical(message string, fields loggo.Fields)
StCritical nothing
func (EmptyLogger) StDebug ¶
func (EmptyLogger) StDebug(message string, fields loggo.Fields)
StDebug nothing
func (EmptyLogger) StError ¶
func (EmptyLogger) StError(message string, fields loggo.Fields)
StError nothing
func (EmptyLogger) StInfo ¶
func (EmptyLogger) StInfo(message string, fields loggo.Fields)
StInfo nothing
func (EmptyLogger) StTrace ¶
func (EmptyLogger) StTrace(message string, fields loggo.Fields)
StTrace nothing
func (EmptyLogger) StWarning ¶
func (EmptyLogger) StWarning(message string, fields loggo.Fields)
StWarning nothing
func (EmptyLogger) Trace ¶
func (EmptyLogger) Trace(format string, args ...interface{})
Trace nothing
func (EmptyLogger) Tracef ¶
func (EmptyLogger) Tracef(format string, args ...interface{})
Tracef nothing
func (EmptyLogger) Warning ¶
func (EmptyLogger) Warning(format string, args ...interface{})
Warning nothing
func (EmptyLogger) Warningf ¶
func (EmptyLogger) Warningf(format string, args ...interface{})
Warningf nothing
type Logger ¶
type Logger interface { StandardLogger StructuredLogger StLogger }
Logger interface to define a logger entity
func GetSafe ¶
GetSafe will verify if given logger is initiated and will return an empty logger when it is not to make log calls safe
func NewLogger ¶
NewLogger constructs a new logger for package @param: packageName stands for the package of your logger @param: depth given one integer will set the depth in which will find during runtime the file and line number recommended to use 3 as a number (only the first integer will be used)
func NewNoCodeLogger ¶
NewNoCodeLogger will not print file
type StLogger ¶
type StLogger interface { StCritical(message string, fields loggo.Fields) StError(message string, fields loggo.Fields) StWarning(message string, fields loggo.Fields) StInfo(message string, fields loggo.Fields) StDebug(message string, fields loggo.Fields) StTrace(message string, fields loggo.Fields) }
StLogger St logging functions for using with loggo.Fields
type StandardLogger ¶
type StandardLogger interface { Tracef(format string, args ...interface{}) Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warningf(format string, args ...interface{}) Errorf(format string, args ...interface{}) }
StandardLogger stan
func NewStandardLogger ¶
func NewStandardLogger(packageName string, depth ...int) StandardLogger
NewStandardLogger constructs a standard logger
type StructuredLogger ¶
type StructuredLogger interface { Trace(msg string, keyValues ...interface{}) Debug(msg string, keyValues ...interface{}) Info(msg string, keyValues ...interface{}) Warning(msg string, keyValues ...interface{}) Error(msg string, keyValues ...interface{}) }
StructuredLogger simplified structured logger signature