Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeZeroLogTestLogger ¶
func InitializeZeroLogTestLogger()
InitializeZeroLogTestLogger is a function that sets up a logger for testing purposes. It disables the global logging level and discards all log output. This is useful in a testing context where log output might not be desired.
Types ¶
type ZeroLogConfig ¶
type ZeroLogConfig struct { Level string FileEnabled bool // FileEnabled whether logging to a file is enabled. FilePath string FileMaxSize int // FileMaxSize the maximum size of the log file. FileMaxBackup int // FileMaxBackup the maximum number of old log files to retain. FileMaxAge int // FileMaxAge the maximum number of days to retain old log files. }
ZeroLogConfig is a struct that holds the configuration settings for Zero log. Zero log is a zero allocation JSON logger in Go that is fast and reliable.
The struct fields are: Level: The logging level. It can be "debug", "info", "warn", "error", "fatal", or "panic". FileEnabled: A boolean indicating whether logging to a file is enabled. FilePath: The path to the log file. This is used if FileEnabled is true. FileMaxSize: The maximum size of the log file in megabytes. FileMaxBackup: The maximum number of old log files to retain. FileMaxAge: The maximum number of days to retain old log files.
func (ZeroLogConfig) ConfigureZeroLog ¶
func (z ZeroLogConfig) ConfigureZeroLog(name, version string)
ConfigureZeroLog configures the global logger with the settings from the ZeroLogConfig. It sets the global logging level, hostname, service name, and version. If FileEnabled is true, it also sets up a file logger.
Parameters: name: The name of the service. This will be included in every log entry. version: The version of the service. This will be included in every log entry.