log

package
v0.0.3-dev Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 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 wanr 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 warn 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) String

func (l Level) String() string

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{})

	// 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
}

Logger is a logging interface

var Log Logger = &defaultLogger{
	level: Info,
}

Log is the global logger

Jump to

Keyboard shortcuts

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