18 lines
379 B
Go
18 lines
379 B
Go
|
package config
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"time"
|
||
|
|
||
|
"github.com/rs/zerolog"
|
||
|
)
|
||
|
|
||
|
// NewLogger creates and initializes a new *zerolog.Logger with the given
|
||
|
// log level.
|
||
|
func NewLogger(level zerolog.Level) *zerolog.Logger {
|
||
|
output := zerolog.ConsoleWriter{Out: os.Stdout, NoColor: false, TimeFormat: time.RFC3339}
|
||
|
logger := zerolog.New(output).With().Timestamp().Logger()
|
||
|
|
||
|
return &logger
|
||
|
}
|