updated hlog

This commit is contained in:
2026-01-13 12:55:30 +11:00
parent 8c2ca4d79a
commit 2a8c39002d
12 changed files with 1224 additions and 21 deletions

View File

@@ -5,11 +5,21 @@ import (
"github.com/rs/zerolog"
)
// Level is an alias for zerolog.Level, representing the severity of a log message.
type Level = zerolog.Level
// Takes a log level as string and converts it to a Level interface.
// If the string is not a valid input it will return InfoLevel
// Valid levels: trace, debug, info, warn, error, fatal, panic
// LogLevel converts a string to a Level value.
//
// Valid level strings (case-sensitive):
// - "trace": Most verbose, for very detailed debugging
// - "debug": Detailed debugging information
// - "info": General informational messages
// - "warn": Warning messages for potentially harmful situations
// - "error": Error messages for error events
// - "fatal": Fatal messages that will exit the application
// - "panic": Panic messages that will panic the application
//
// Returns an error if the provided string is not a valid log level.
func LogLevel(level string) (Level, error) {
levels := map[string]zerolog.Level{
"trace": zerolog.TraceLevel,