log

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string)

Debug is used to print debug logs

func Debugf

func Debugf(format string, args ...interface{})

Debugf is used to print formatted debug level logs

func Debugw

func Debugw(msg string, keyvals ...interface{})

Debugw is used to print debug level logs containing additional kv information

func Enabled

func Enabled(level Level) bool

Enabled is used to confirm the log level of the current configuration

func Error

func Error(msg string)

Error is used to print error level logs

func Errorf

func Errorf(format string, args ...interface{})

Errorf is used to print formatted error level logs

func Errorw

func Errorw(msg string, keyvals ...interface{})

Errorw is used to print error level logs containing additional kv information

func Fatal

func Fatal(msg string)

Fatal is used to print fatal level logs This function will call the os.Exit(1) to exit the process after the log is printed

func Fatalf

func Fatalf(format string, args ...interface{})

Fatalf is used to print formatted fatal level logs This function will call the os.Exit(1) to exit the process after the log is printed

func Fatalw

func Fatalw(msg string, keyvals ...interface{})

Fatalw is used to print fatal level logs containing additional kv information This function will call the os.Exit(1) to exit the process after the log is printed

func Info

func Info(msg string)

Info is used to print info level logs

func Infof

func Infof(format string, args ...interface{})

Infof is used to print formatted info level logs

func Infow

func Infow(msg string, keyvals ...interface{})

Infow is used to print info level logs containing additional kv information

func Panic

func Panic(msg string)

Panic is used to print panic level logs This function will call the panic(err) after the log is printed

func Panicf

func Panicf(format string, args ...interface{})

Panicf is used to print formatted panic level logs This function will call the panic(err) after the log is printed

func Panicw

func Panicw(msg string, keyvals ...interface{})

Panicw is used to print painc level logs containing additional kv information This function will call the panic(err) after the log is printed

func SetLogger

func SetLogger(logger Logger)

SetLogger is configured here to use the global logging component

func Warn

func Warn(msg string)

Warn is used to print warning level logs

func Warnf

func Warnf(format string, args ...interface{})

Warnf is used to print formatted warning level logs

func Warnw

func Warnw(msg string, keyvals ...interface{})

Warnw is used to print warning level logs containing additional kv information

Types

type DefaultLogger

type DefaultLogger struct {
}

DefaultLogger provides the default implementation of the logging component

func (*DefaultLogger) Enabled

func (d *DefaultLogger) Enabled(level Level) bool

Enabled implements log level queries for default log components

func (*DefaultLogger) Log

func (d *DefaultLogger) Log(level Level, msg string, keyvals ...interface{})

Log implements the log output of the default log component

type Level

type Level int

Level is the definition of the log level in the log component

const (
	// DebugLevel means Debug and above log level
	DebugLevel Level = iota
	// InfoLevel means Info and above log level
	InfoLevel
	// WarnLevel means Warn and above log level
	WarnLevel
	// ErrorLevel means Error and above log level
	ErrorLevel
	// PanicLevel means Panic and above log level
	PanicLevel
	// FatalLevel means Fatal and above log level
	FatalLevel
)

func ParseLevel

func ParseLevel(l string) Level

ParseLevel provides a method for creating log level objects through strings

func (Level) String

func (l Level) String() string

String provides a method for converting log level files to strings

type Logger

type Logger interface {
	Log(level Level, msg string, keyvalues ...interface{})
	Enabled(level Level) bool
}

Logger is an abstract definition of the functionality of a logging component

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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