### Quick Start Guide Source: https://github.com/lazygophers/log/blob/master/README.md A basic example demonstrating how to set the log level and log messages at different severity levels using the lazygophers/log library. ```go package main import "github.com/lazygophers/log" func main() { // 设置日志级别 log.SetLevel(log.InfoLevel) // 记录日志 log.Info("Application started") log.Debug("This is debug message") // 不会被输出 log.Warn("Something might be wrong") // 格式化日志 log.Infof("User %s logged in", "Alice") // 记录错误 log.Error("Failed to connect database") } ``` -------------------------------- ### Install lazygophers/log Source: https://github.com/lazygophers/log/blob/master/README.md Instructions for installing the lazygophers/log library using the Go module system. ```bash go get github.com/lazygophers/log ``` -------------------------------- ### API Reference Source: https://github.com/lazygophers/log/blob/master/README.md Comprehensive API documentation for the lazygophers/log library, detailing core structures, logging methods, and configuration options. ```APIDOC Core Structures: log: The main logger instance. SetLevel(level Level): Sets the global logging level. Only messages at or above this level will be output. SetOutput(writers ...io.Writer): Configures the output destinations for log messages. Accepts multiple io.Writer interfaces. Clone(): Creates a new logger instance that is a copy of the current one, allowing for independent configuration. SetCallerDepth(depth int): Adjusts the depth at which the caller information (file, line, function) is captured. Useful for wrapping loggers. Logging Methods (by Level): Trace/Tracef(msg string, args ...interface{}): Logs a message at the TRACE level. Tracef supports formatted strings. Debug/Debugf(msg string, args ...interface{}): Logs a message at the DEBUG level. Debugf supports formatted strings. Info/Infof(msg string, args ...interface{}): Logs a message at the INFO level. Infof supports formatted strings. Warn/Warnf(msg string, args ...interface{}): Logs a message at the WARN level. Warnf supports formatted strings. Error/Errorf(msg string, args ...interface{}): Logs a message at the ERROR level. Errorf supports formatted strings. Fatal/Fatalf(msg string, args ...interface{}): Logs a message at the FATAL level and then calls os.Exit(1). Fatalf supports formatted strings. Panic/Panicf(msg string, args ...interface{}): Logs a message at the PANIC level and then triggers a panic. Panicf supports formatted strings. Configuration Methods: SetPrefixMsg(): Enables setting a custom prefix for log messages. SetSuffixMsg(): Enables setting a custom suffix for log messages. ParsingAndEscaping(): Toggles the parsing and escaping of log message content. Caller(): Toggles the inclusion of caller information (file, line, function name) in log output. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.