log

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package log provides a simple and flexible logging library with various log levels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuditLn added in v0.15.7

func AuditLn(correlationId *string, v ...any)

AuditLn logs an audit message with the provided correlationId and message arguments. Audit messages are always logged, regardless of the current log level.

func DebugLn

func DebugLn(correlationId *string, v ...any)

DebugLn logs a debug message with the provided correlationId and message arguments if the current log level is Debug or lower.

func ErrorLn

func ErrorLn(correlationId *string, v ...any)

ErrorLn logs an error message with the provided correlationId and message arguments if the current log level is Error or lower.

func FatalLn

func FatalLn(correlationId *string, v ...any)

FatalLn logs a fatal message with the provided correlationId and message arguments. The application will exit after the message is logged.

func InfoLn

func InfoLn(correlationId *string, v ...any)

InfoLn logs an informational message with the provided correlationId and message arguments if the current log level is Info or lower.

func SetLevel

func SetLevel(l Level)

SetLevel sets the global log level to the provided level.

The log level is only updated if the provided level is valid (Off, Fatal, Error, Warn, Info, Audit, Debug, or Trace).

func TraceLn

func TraceLn(correlationId *string, v ...any)

TraceLn logs a trace message with the provided correlationId and message arguments if the current log level is Trace or lower.

func WarnLn

func WarnLn(correlationId *string, v ...any)

WarnLn logs a warning message with the provided correlationId and message arguments if the current log level is Warn or lower.

Types

type Level

type Level int

Level represents log levels.

const (
	Off Level = iota
	Fatal
	Error
	Warn
	Info
	Audit
	Debug
	Trace
)

func GetLevel

func GetLevel() Level

GetLevel returns the current global log level.

Jump to

Keyboard shortcuts

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