fix internal logger wrapper #106

Merged
vtolstov merged 1 commits from fixup_logger into v3 2023-01-07 23:47:27 +03:00
Showing only changes of commit 9e952ffa25 - Show all commits

View File

@ -23,6 +23,23 @@ func (l *consulLogger) Name() string {
return l.logger.String()
}
func (l *consulLogger) GetLevel() hclog.Level {
switch l.logger.Options().Level {
case logger.DebugLevel:
return hclog.Debug
case logger.TraceLevel:
return hclog.Trace
case logger.InfoLevel:
return hclog.Info
case logger.WarnLevel:
return hclog.Warn
case logger.ErrorLevel:
return hclog.Error
default:
return hclog.Info
}
}
func (l *consulLogger) With(args ...interface{}) hclog.Logger {
fields := make(map[string]interface{}, int(len(args)/2))
for i := 0; i < int(len(args)/2); i += 2 {