apmlog

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvLogFile is the environment variable that controls where the default logger writes.
	EnvLogFile = "ATATUS_LOG_FILE"

	// EnvLogLevel is the environment variable that controls the default logger's level.
	EnvLogLevel = "ATATUS_LOG_LEVEL"

	// DefaultLevel holds the default log level, if EnvLogLevel is not specified.
	DefaultLevel Level = ErrorLevel
)

Variables

This section is empty.

Functions

func InitDefaultLogger

func InitDefaultLogger()

InitDefaultLogger initialises DefaultLogger using the environment variables ATATUS_LOG_FILE and ATATUS_LOG_LEVEL.

Types

type Level

type Level uint32

Level represents a log level.

const (
	TraceLevel Level = iota
	DebugLevel
	InfoLevel
	WarningLevel
	ErrorLevel
	CriticalLevel
	OffLevel
)

Log levels.

func ParseLogLevel

func ParseLogLevel(s string) (Level, error)

ParseLogLevel parses s as a log level.

func (Level) String

func (l Level) String() string

type LevelLogger

type LevelLogger struct {
	// contains filtered or unexported fields
}

LevelLogger is a level logging implementation that will log to a file, stdout, or stderr. The level may be updated dynamically via SetLevel.

var (
	// DefaultLogger is the default Logger to use, if ATATUS_LOG_* are specified.
	DefaultLogger *LevelLogger
)

func (*LevelLogger) Debugf

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

Debugf logs a message with log.Printf, with a DEBUG prefix.

func (*LevelLogger) Errorf

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

Errorf logs a message with log.Printf, with an ERROR prefix.

func (*LevelLogger) Level

func (l *LevelLogger) Level() Level

Level returns the current logging level.

func (*LevelLogger) SetLevel

func (l *LevelLogger) SetLevel(level Level)

SetLevel sets level as the minimum logging level.

func (*LevelLogger) Warningf

func (l *LevelLogger) Warningf(format string, args ...interface{})

Warningf logs a message with log.Printf, with a WARNING prefix.

Jump to

Keyboard shortcuts

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