Documentation
¶
Index ¶
- type LogBuffer
- type LogFormat
- type Logger
- func (l *Logger) AddWriter(writer io.Writer, format LogFormat, colored bool)
- func (l *Logger) Debug(args ...any)
- func (l *Logger) Error(args ...any)
- func (l *Logger) Info(args ...any)
- func (l *Logger) Level() zerolog.Level
- func (l *Logger) NewSubLogger(key string, value string) *Logger
- func (l *Logger) Panic(args ...any)
- func (l *Logger) RemoveWriter(writer io.Writer, format LogFormat, colored bool)
- func (l *Logger) SetLevel(level zerolog.Level)
- func (l *Logger) Trace(args ...any)
- func (l *Logger) Warn(args ...any)
- type StructuredLogInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogBuffer ¶
type LogBuffer struct {
// contains filtered or unexported fields
}
LogBuffer is a helper object that can be used to buffer log messages. A log buffer is effectively a list of arguments of any type. This object is especially useful when attempting to log complex objects (e.g. execution trace) that have complex coloring schemes and formatting. The LogBuffer can then be passed on to a Logger object to then log the buffer to console and any other writers (e.g. file).
func (LogBuffer) ColorString ¶ added in v0.1.4
ColorString provides the colorized string representation of the LogBuffer
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger describes a custom logging object that can log events to any arbitrary channel in structured, unstructured with colors, and unstructured formats.
var GlobalLogger *Logger
GlobalLogger describes a Logger that is disabled by default and is instantiated when the fuzzer is created. Each module/package should create its own sub-logger. This allows to create unique logging instances depending on the use case.
func NewLogger ¶
NewLogger will create a new Logger object with a specific log level. By default, a logger that is instantiated with this function is not usable until a log channel is added. To add or remove channels that the logger streams logs to, call the Logger.AddWriter and Logger.RemoveWriter functions.
func (*Logger) AddWriter ¶
AddWriter will add a writer to which log output will go to. If the format is structured then the writer will get structured output. If the writer is unstructured, then the writer has the choice to either receive colored or un-colored output. Note that unstructured writers will be converted into a zerolog.ConsoleWriter to maintain the same format across all unstructured output streams.
func (*Logger) NewSubLogger ¶
NewSubLogger will create a new Logger with unique context in the form of a key-value pair. The expected use of this is for each module or component of the system to create their own contextualized logs. The key can be used to search for logs from a specific module or component.
func (*Logger) RemoveWriter ¶
RemoveWriter will remove a writer from the list of writers that the logger manages. The writer will be either removed from the list of structured, unstructured and colored, or unstructured and un-colored writers. If the same writer is receiving multiple types of log output (e.g. structured and unstructured with color) then this function must be called multiple times. If the writer does not exist in any list, then this function is a no-op.
type StructuredLogInfo ¶
StructuredLogInfo describes a key-value mapping that can be used to log structured data