log

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TraceLevel  = log.DebugLevel - 4
	DebugLevel  = log.DebugLevel
	InfoLevel   = log.InfoLevel
	WarnLevel   = log.WarnLevel
	ErrorLevel  = log.ErrorLevel
	FatalLevel  = log.FatalLevel
	NoLogsLevel = log.Level(50)
)

Our custom log levels

View Source
var (
	Trace, Debug, Info, Warn, Error, Fatal func(msg any, keyVals ...any)
)

Public function bindings for the default logger

Functions

func Create

func Create(output io.Writer) (regular *log.Logger, trace *log.Logger)

Create creates a new logger instance.

func DetectLevel

func DetectLevel()

DetectLevel detects the appropriate level based on the DEBUG environment variable's contents.

func DetectTrace

func DetectTrace() bool

DetectTrace detects if the DEBUG environment variable is set to trace and enables trace logs.

func DetectTraceEnv

func DetectTraceEnv() bool

DetectTraceEnv detects if the DEBUG environment variable is set to trace.

func GetLevel

func GetLevel() log.Level

GetLevel returns the level of the default logger.

func Init

func Init(output io.Writer)

Initialize the traceLogger instance.

func SetLevel

func SetLevel(level log.Level)

SetLevel sets the log level for the logger. If the requested level is TraceLevel, it will enable trace logs and set the level to TraceLevel.

func Swap

func Swap(output io.Writer) func()

Swap swaps out the logger output target for a new one and returns a function to restore the original.

func ToggleTrace

func ToggleTrace(toggle bool)

ToggleTrace toggles the trace logs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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