tuxlog

package module
v0.4.0 Latest Latest
Warning

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

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

README

tuxlog

PkgGoDev Build Tests Lint CodeQL Go Report Card

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

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

This is currently used by cablemodemcli and other projects in go used by tuxgal and tuxgalhomelab.

Documentation

Overview

Package tuxlog provides a minimalistic level logging library based on the tuxlogi level logging interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(userConfig *Config) tuxlogi.Logger

NewLogger instantiates a Logger.

Types

type Config

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

func NewConsoleLoggerConfig() *Config

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

func NewVanillaLoggerConfig

func NewVanillaLoggerConfig() *Config

type Level

type Level uint8

Level represents the logging level used by the tuxlog 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 tuxlog logger.

func (Level) String

func (l Level) String() string

Jump to

Keyboard shortcuts

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