zzzlog

package module
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: Apache-2.0 Imports: 7 Imported by: 5

README

zzzlog

PkgGoDev Build Tests Lint CodeQL Go Report Card

A go library that provides minimalistic level logging based on the zzzlogi generic level logging interface.

The goal is minimalism with no external dependencies other than the standard go library and the zzzlogi interface itself.

This is currently used by cablemodemcli and other projects in go used by Tuxdude and TuxdudeHomeLab.

Documentation

Overview

Package zzzlog provides a minimalistic level logging library based on the zzzlogi level logging interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(userConfig *Config) zzzlogi.Logger

NewLogger instantiates a Logger.

Types

type Config added in v0.2.0

type Config struct {
	// Dest is the logging destination for the logs.
	Dest io.Writer
	// Level determines the maximum logging level.
	MaxLevel Level
	// SkipTimestamp set to true skips logging the timestamp in the logs.
	SkipTimestamp bool
	// SkipLogLevel seto to true skips logging the log level in the logs.
	SkipLogLevel bool
	// SkipCallerInfo set to true skips logging the call site information.
	SkipCallerInfo bool
	// PanicInFatal set to true causes the log message to be emitted
	// through panic() after logging, instead of the default behavior of
	// exiting with a status code 1 when using Fatal or FatalF logging methods.
	PanicInFatal bool
	// TimestampLoggingFormat determines the format for logging the timestamps.
	TimestampLoggingFormat string
}

Config contains the configuration for the logger.

func NewConsoleLoggerConfig added in v0.2.1

func NewConsoleLoggerConfig() *Config

NewConsoleLoggerConfig returns a logger configuration for logging to stdout with the maximum logging level set to Info.

func NewVanillaLoggerConfig added in v0.3.2

func NewVanillaLoggerConfig() *Config

type Level added in v0.2.0

type Level uint8

Level represents the logging level used by the zzzlog logger.

const (
	// LvlFatal represents the Fatal log level.
	LvlFatal Level = iota
	// LvlError represents the Error log level.
	LvlError
	// LvlWarn represents the Warn log level.
	LvlWarn
	// LvlInfo represents the Info log level.
	LvlInfo
	// LvlDebug represents the Debug log level.
	LvlDebug
	// LvlTrace represents the Trace log level.
	LvlTrace
)

Logging levels used by the zzzlog logger.

func (Level) String added in v0.3.4

func (l Level) String() string

Jump to

Keyboard shortcuts

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