- Remove logger as globals to use dedicated pointer (#104)

# Refactor Logger :
- Remove logger as globals to use dedicated pointer
- Add compat file to allow retro-compatibility (function are deprecated)
- Add field management to allow add custom information
- Add option struct to manage options
- Add entry struct to manage all log entry
- Add multithreading capabilities (with race prevention)
- Allow to log to file + stdout/stderr + syslog
- Add io.WriteCloser compatibility interface
- Add logrus hook to manage option by hook instance
- Add capabilities to custom each logfile/syslog/standard independently
- Add small test suite

# Update Packages for logger new options : 
- archive
- cluster
- context
- httpcli
- httpserver
- ldap
- tests

# Other : 
- bump dependancies
- update minio server for aws test
This commit is contained in:
Nicolas JUHEL
2021-05-21 17:32:47 +02:00
committed by GitHub
parent 9ac6920e16
commit c127359ffb
30 changed files with 2776 additions and 850 deletions

View File

@@ -76,17 +76,22 @@ var (
)
func init() {
liblog.EnableColor()
liblog.SetLevel(liblog.DebugLevel)
liblog.AddGID(true)
liblog.FileTrace(true)
liblog.SetFormat(liblog.TextFormat)
liblog.Timestamp(true)
liberr.SetModeReturnError(liberr.ErrorReturnCodeErrorTraceFull)
ctx, cnl = context.WithCancel(context.Background())
liblog.SetLevel(liblog.DebugLevel)
if err := liblog.GetDefault().SetOptions(ctx, &liblog.Options{
DisableStandard: false,
DisableStack: false,
DisableTimestamp: false,
EnableTrace: true,
TraceFilter: "",
DisableColor: false,
}); err != nil {
panic(err)
}
cfgPool = libsrv.PoolServerConfig{cfgSrv01, cfgSrv02, cfgSrv03}
cfgPool.MapUpdate(func(cfg libsrv.ServerConfig) libsrv.ServerConfig {
cfg.SetParentContext(func() context.Context {