go-urlsh/internal/config/logger.go

17 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
}