Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Panic ¶ added in v0.0.3
func Panic(message string)
Panic immediately panics with the given message. This should be used only in unrecoverable situations where the application must stop immediately.
Example:
Panic("Critical configuration missing") // Panics with message: "Critical configuration missing"
func Panicf ¶ added in v0.0.3
Panicf immediately panics with the formatted message. This should be used only in unrecoverable situations where the application must stop immediately.
Example:
Panicf("Critical configuration missing: %s", "database credentials") // Panics with message: "Critical configuration missing: database credentials"
Types ¶
type ZLogger ¶
type ZLogger interface { Context(ctx context.Context, keys []string) ZLogger Segment(mainSegment string, detail ...string) ZLogger Error(err error) ZLogger Alert() ZLogger WithSource() ZLogger WithCallStack() ZLogger Message(message string) Msg(message string) Messagef(format string, args ...any) Msgf(format string, args ...any) Fatal(message string) Fatalf(format string, args ...any) }
func Debug ¶
func Debug() ZLogger
Debug returns a new logger instance at Debug level. Debug level is used for detailed troubleshooting and development information. The call stack depth is set to 20 for comprehensive debugging.
Example:
Debug().Message("Processing item details") // Output: {"level":"debug","time":"2024-03-07T10:00:00Z","message":"Processing item details"}
func Error ¶
func Error() ZLogger
Error returns a new logger instance at Error level. Error level is used for errors that should be investigated. The call stack depth is set to 10 for detailed error tracing.
Example:
Error().Error(err).Message("Failed to process request") // Output: {"level":"error","time":"2024-03-07T10:00:00Z","error_msg":"connection refused","message":"Failed to process request"}
func Info ¶
func Info() ZLogger
Info returns a new logger instance at Info level. Info level is used for general operational entries about what's going on inside the application. The call stack depth is set to 5 for basic tracing.
Example:
Info().Message("Application started successfully") // Output: {"level":"info","time":"2024-03-07T10:00:00Z","message":"Application started successfully"}
func Warn ¶
func Warn() ZLogger
Warn returns a new logger instance at Warn level. Warn level is used for potentially harmful situations and recoverable errors. The call stack depth is set to 5 for basic tracing.
Example:
Warn().Message("High memory usage detected") // Output: {"level":"warn","time":"2024-03-07T10:00:00Z","message":"High memory usage detected"}