config

package
v3.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLevel              LogLevel.LogLevel = LogLevel.INFO
	DefaultMaxBufferSizeBytes int               = 4096               // 4 KB
	DefaultMaxFileSizeBytes   int               = 1024 * 1024 * 1024 // 1 GB
	DefaultFlushInterval      time.Duration     = 15 * time.Second   // 15 seconds
	DefaultDirectoryPath      string            = "."
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Level              *LogLevel.LogLevel // the minimum log level to write. Default is INFO.
	MaxBufferSizeBytes *int               // the maximum size of the write buffer before it is flushed. Default is 4 KB.
	MaxFileSizeBytes   *int               // the maximum size of the log file before it is rotated. Default is 1 GB.
	FlushInterval      *time.Duration     // the interval at which the write buffer is flushed. Default is 15 seconds.
	DirectoryPath      *string            // the directory path where the log file is stored. Default is the current working directory ("."). To disable file logging, set this to an empty string.
	ConsoleOut         *ConsoleLogger     // the logger to write to the console. Default is ConsoleLogger{l: nil}. When l is nil, console logging is disabled. This is configurable for easy testing.
}

Config holds the configuration settings for the Logger.

func (*Config) ApplyDefaults

func (cfg *Config) ApplyDefaults()

ApplyDefaults applies the default values to the given Config if they are nil.

type ConsoleLogger

type ConsoleLogger struct {
	L *log.Logger
}

ConsoleLogger wraps *log.Logger to allow nil value semantics for disabled state

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL