forked from TrueCloudLab/frostfs-node
[#1770] logger: Refactor Logger
component
Make it store its internal `zap.Logger`'s level. Also, make all the components to accept internal `logger.Logger` instead of `zap.Logger`; it will simplify future refactor. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
4baf00aa21
commit
f037022a7a
83 changed files with 207 additions and 156 deletions
|
@ -12,6 +12,9 @@ const sampling = 1000
|
|||
//
|
||||
// If debug, development logger is created.
|
||||
func NewLogger(debug bool) *logger.Logger {
|
||||
var l logger.Logger
|
||||
l.Logger = zap.L()
|
||||
|
||||
if debug {
|
||||
cfg := zap.NewDevelopmentConfig()
|
||||
cfg.Sampling = &zap.SamplingConfig{
|
||||
|
@ -26,8 +29,8 @@ func NewLogger(debug bool) *logger.Logger {
|
|||
panic("could not prepare logger: " + err.Error())
|
||||
}
|
||||
|
||||
return log
|
||||
l.Logger = log
|
||||
}
|
||||
|
||||
return zap.L()
|
||||
return &l
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue