forked from TrueCloudLab/frostfs-node
[#736] logger: Add journald support
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
b36a453238
commit
962e5a9c19
11 changed files with 108 additions and 6 deletions
|
@ -96,7 +96,8 @@ type applicationConfiguration struct {
|
|||
_read bool
|
||||
|
||||
LoggerCfg struct {
|
||||
level string
|
||||
level string
|
||||
destination string
|
||||
}
|
||||
|
||||
EngineCfg struct {
|
||||
|
@ -209,6 +210,7 @@ func (a *applicationConfiguration) readConfig(c *config.Config) error {
|
|||
// Logger
|
||||
|
||||
a.LoggerCfg.level = loggerconfig.Level(c)
|
||||
a.LoggerCfg.destination = loggerconfig.Destination(c)
|
||||
|
||||
// Storage Engine
|
||||
|
||||
|
@ -1004,6 +1006,11 @@ func (c *cfg) loggerPrm() (*logger.Prm, error) {
|
|||
// not expected since validation should be performed before
|
||||
panic(fmt.Sprintf("incorrect log level format: %s", c.LoggerCfg.level))
|
||||
}
|
||||
err = c.dynamicConfiguration.logger.SetDestination(c.LoggerCfg.destination)
|
||||
if err != nil {
|
||||
// not expected since validation should be performed before
|
||||
panic(fmt.Sprintf("incorrect log destination format: %s", c.LoggerCfg.destination))
|
||||
}
|
||||
|
||||
return c.dynamicConfiguration.logger, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue