Package Logger:

- Rework logger
- Remove deprecated functions
- Split Logger to sub package (fields, level, config, ...)
- Optimize dependencies
- Rework Hookfile: fix error like FD still opened
- Rework Hooksyslog: use same model like Hookfile, use network/protocol instead of self lib
- Rework HookStd: use independent hook for std out & std err
- Fix std config make generic options for files & syslog
- Apply formatter to hook instead of main logger entry
- optimize code

Package ioutils:
- rework PathCheckCreate funct: optimize code & fix some error

Package Network:
- create sub package protocol for all network protocl use
- add encode function

Package httpcli:
- remove file network
- use package network/protocol instead of network file

Package archive:
- apply change following rework of logger

Package aws:
- apply change following rework of logger

Package cluster:
- apply change following rework of logger

Package cobra:
- apply change following rework of logger

Package Config Component:
- apply change following rework of logger to component log
- fix logger for monitoring
- fix component following fix of package request / monitoring

Package context:
- apply change following rework of logger

Package database:
- apply change following rework of logger

Package httpserver:
- apply change following rework of logger

Package ldap:
- apply change following rework of logger

Package monitor:
- apply change following rework of logger
- fix logger for monitoring
- fix minor bugs

Package nats:
- apply change following rework of logger

Package nutsdb:
- apply change following rework of logger

Package request:
- apply change following rework of logger
- fix minor bug
- fix missing logger for monitoring
- add one line for healthcheck (info or error)

Package router:
- apply change following rework of logger

Package static:
- apply change following rework of logger

Package status:
- apply change following rework of logger
- fix bug with mandatory component

Package viper:
- apply change following rework of logger

Other:
- bump dependencies
- github action workflow fix
This commit is contained in:
nabbar
2023-06-19 15:53:42 +02:00
parent abe84d7498
commit f31950daef
117 changed files with 4178 additions and 2487 deletions

View File

@@ -66,15 +66,36 @@ func (s *staticHandler) _getLogger() liblog.Logger {
s.m.RLock()
defer s.m.RUnlock()
var log liblog.Logger
if s.l == nil {
return liblog.GetDefault()
} else if log := s.l(); log == nil {
return liblog.GetDefault()
s.m.RUnlock()
log = s._getDefaultLogger()
s.m.RLock()
return log
} else if log = s.l(); log == nil {
s.m.RUnlock()
log = s._getDefaultLogger()
s.m.RLock()
return log
} else {
return log
}
}
func (s *staticHandler) _getDefaultLogger() liblog.Logger {
s.m.Lock()
defer s.m.Unlock()
var log = liblog.New(s.d.GetContext)
s.l = func() liblog.Logger {
return log
}
return log
}
func (s *staticHandler) RegisterLogger(log func() liblog.Logger) {
s._setLogger(log)
}

View File

@@ -38,7 +38,7 @@ import (
ginsdk "github.com/gin-gonic/gin"
ginrdr "github.com/gin-gonic/gin/render"
liberr "github.com/nabbar/golib/errors"
liblog "github.com/nabbar/golib/logger"
loglvl "github.com/nabbar/golib/logger/level"
librtr "github.com/nabbar/golib/router"
_ "github.com/ugorji/go/codec"
)
@@ -118,7 +118,7 @@ func (s *staticHandler) Get(c *ginsdk.Context) {
if inf, buf, err = s._fileGet(calledFile); err != nil {
c.AbortWithStatus(http.StatusInternalServerError)
ent := s._getLogger().Entry(liblog.ErrorLevel, "get file info")
ent := s._getLogger().Entry(loglvl.ErrorLevel, "get file info")
ent.FieldAdd("filePath", calledFile)
ent.FieldAdd("requestPath", c.Request.URL.Path)
ent.ErrorAdd(true, err)