go-urlsh/internal/config/logger.go

18 lines
379 B
Go
Raw Normal View History

2024-09-30 13:19:01 +02:00
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
}