Documentation ¶
Overview ¶
Package log4go
This is a golang Logger inspired by log4js
Index ¶
- Variables
- func AddAppender(key string, f *func(config *pkg.AppenderConfig) pkg.Appender)
- func AddLayout(key string, f *func(*pkg.LayoutConfig) pkg.Layout)
- func Configure(c any) error
- func IsConfigured() bool
- func Shutdown()
- type Logger
- func (l *Logger) AddContext(key string, value any)
- func (l *Logger) ChangeManyContext(c map[string]any)
- func (l *Logger) ChangeOneContext(key string, value any)
- func (l *Logger) ClearContext()
- func (l *Logger) Debug(args ...any)
- func (l *Logger) DebugWithContext(c map[string]any, args ...any)
- func (l *Logger) Error(args ...any)
- func (l *Logger) ErrorWithContext(c map[string]any, args ...any)
- func (l *Logger) Fatal(args ...any)
- func (l *Logger) FatalWithContext(c map[string]any, args ...any)
- func (l *Logger) Info(args ...any)
- func (l *Logger) InfoWithContext(c map[string]any, args ...any)
- func (l *Logger) RemoveContext(key string)
- func (l *Logger) Terminate()
- func (l *Logger) Trace(args ...any)
- func (l *Logger) TraceWithContext(c map[string]any, args ...any)
- func (l *Logger) Warn(args ...any)
- func (l *Logger) WarnWithContext(c map[string]any, args ...any)
Constants ¶
This section is empty.
Variables ¶
var ProcessPid = os.Getpid()
Functions ¶
func AddAppender ¶
func AddAppender(key string, f *func(config *pkg.AppenderConfig) pkg.Appender)
AddAppender Use this function to making new custom appenders. You can't use a default appender name like dateFile, file and so on. If you call this function twice with the same key, the last function provided will be retained
func AddLayout ¶
func AddLayout(key string, f *func(*pkg.LayoutConfig) pkg.Layout)
AddLayout Use this function to creating a new custom layouts. If you use a predefined key (e.g. basic, pattern and others), Log4Go will not use the custom layout. If you call this function twice, with the same key but different functions, Log4Go will use the last provided definition
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func GetLogger ¶
GetLogger this function returns a Log4GoLogger. its get an array of strings, but it used only the first if you don't pass anything to this method, it returns a Log4GoLogger with name "defaults"
func (*Logger) AddContext ¶
func (*Logger) ChangeManyContext ¶
func (*Logger) ChangeOneContext ¶
func (*Logger) ClearContext ¶
func (l *Logger) ClearContext()