log

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugEnabled

func DebugEnabled() bool

DebugEnabled returns whether output of messages at the debug level is currently enabled.

func Debugf

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

Debugf logs potentially verbose debug-time data

func ErrorEnabled

func ErrorEnabled() bool

ErrorEnabled returns whether output of messages at the info level is currently enabled.

func Errorf

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

Errorf logs error conditions.

func InfoEnabled

func InfoEnabled() bool

InfoEnabled returns whether output of messages at the info level is currently enabled.

func Infof

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

Infof logs at the info level

func WarnEnabled

func WarnEnabled() bool

WarnEnabled returns whether output of messages at the info level is currently enabled.

func Warnf

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

Warnf logs suspect situations and recoverable errors

Types

type Level

type Level int

Level is a level of logging

const (
	// Error log level
	Error Level = iota
	// Warn log level
	Warn
	// Info log level
	Info
	// Debug log level
	Debug
)

func ParseLevel

func ParseLevel(lvl string) Level

ParseLevel parses the log level, returns Info level if not found

func (Level) DebugEnabled

func (l Level) DebugEnabled() bool

DebugEnabled returns whether output of messages at the debug level is currently enabled.

func (Level) ErrorEnabled

func (l Level) ErrorEnabled() bool

ErrorEnabled returns whether output of messages at the error level is currently enabled.

func (Level) InfoEnabled

func (l Level) InfoEnabled() bool

InfoEnabled returns whether output of messages at the info level is currently enabled.

func (Level) String

func (l Level) String() string

func (Level) WarnEnabled

func (l Level) WarnEnabled() bool

WarnEnabled returns whether output of messages at the warn level is currently enabled.

type LevelWrapper

type LevelWrapper struct {
	Logger   Logger
	LogLevel Level
}

LevelWrapper is a logger adapter

func (*LevelWrapper) DebugEnabled

func (d *LevelWrapper) DebugEnabled() bool

DebugEnabled returns whether output of messages at the debug level is currently enabled.

func (*LevelWrapper) Debugf

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

Debugf logs potentially verbose debug-time data

func (*LevelWrapper) ErrorEnabled

func (d *LevelWrapper) ErrorEnabled() bool

ErrorEnabled returns whether output of messages at the wanr level is currently enabled.

func (*LevelWrapper) Errorf

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

Errorf logs error conditions.

func (*LevelWrapper) InfoEnabled

func (d *LevelWrapper) InfoEnabled() bool

InfoEnabled returns whether output of messages at the info level is currently enabled.

func (*LevelWrapper) Infof

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

Infof logs standard log data

func (*LevelWrapper) Level

func (d *LevelWrapper) Level() Level

Level returns the output level.

func (*LevelWrapper) SetLevel

func (d *LevelWrapper) SetLevel(level Level)

SetLevel sets the output level.

func (*LevelWrapper) WarnEnabled

func (d *LevelWrapper) WarnEnabled() bool

WarnEnabled returns whether output of messages at the warn level is currently enabled.

func (*LevelWrapper) Warnf

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

Warnf logs suspect situations and recoverable errors

type Logger

type Logger interface {
	// Debugf logs potentially verbose debug-time data
	Debugf(format string, args ...interface{})
	// Infof logs informational data
	Infof(format string, args ...interface{})
	// Warnf logs suspect situations and recoverable errors
	Warnf(format string, args ...interface{})
	// Errorf logs error conditions.
	Errorf(format string, args ...interface{})
}

Logger is a logging interface

type LoggerWithLevel

type LoggerWithLevel interface {
	Logger

	// Level gets the current logging level
	Level() Level
	// SetLevel set the current logging level
	SetLevel(level Level)

	// DebugEnabled returns whether output of messages at the debug level is currently enabled.
	DebugEnabled() bool
	// InfoEnabled returns whether output of messages at the info level is currently enabled.
	InfoEnabled() bool
	// WarnEnabled returns whether output of messages at the warn level is currently enabled.
	WarnEnabled() bool
	// ErrorEnabled returns whether output of messages at the error level is currently enabled.
	ErrorEnabled() bool
}

LoggerWithLevel is a logger with level funcs

var Log LoggerWithLevel

Log is the global logger

Jump to

Keyboard shortcuts

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