log

package
v0.0.0-...-297ae51 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: BSD-2-Clause, BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package log implements a simple set of leveled logging wrappers around the standard log package.

Index

Constants

View Source
const (

	// LevelError is the ERROR log level (NOTICE/ERROR).
	LevelError = iota

	// LevelWarn is the WARN log level,  (NOTICE/ERROR/WARN).
	LevelWarn

	// LevelInfo is the INFO log level, (NOTICE/ERROR/WARN/INFO).
	LevelInfo

	// LevelDebug is the DEBUG log level, (NOTICE/ERROR/WARN/INFO/DEBUG).
	LevelDebug
)

Variables

This section is empty.

Functions

func Debugf

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

Debugf logs the given format string/arguments at the DEBUG log level.

func ElideAddr

func ElideAddr(addrStr string) string

ElideAddr transforms the string representation of the provided address based on the unsafeLogging setting. Callers that wish to log IP addreses should use ElideAddr to sanitize the contents first.

func ElideError

func ElideError(err error) string

ElideError transforms the string representation of the provided error based on the unsafeLogging setting. Callers that wish to log errors returned from Go's net package should use ElideError to sanitize the contents first.

func Enabled

func Enabled() bool

Enabled returns if logging is enabled.

func Errorf

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

Errorf logs the given format string/arguments at the ERROR log level.

func Infof

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

Infof logs the given format string/arguments at the INFO log level.

func Init

func Init(enable bool, logFilePath string, unsafe bool) error

Init initializes logging with the given path, and log safety options.

func Level

func Level() int

Level returns the current log level.

func Noticef

func Noticef(format string, a ...interface{})

Noticef logs the given format string/arguments at the NOTICE log level. Unless logging is disabled, Noticef logs are always emitted.

func SetLogLevel

func SetLogLevel(logLevelStr string) error

SetLogLevel sets the log level to the value indicated by the given string (case-insensitive).

func Unsafe

func Unsafe() bool

Unsafe returns if unsafe logging is allowed (the caller MAY skip eliding addresses and other bits of sensitive information).

func Warnf

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

Warnf logs the given format string/arguments at the WARN log level.

Types

This section is empty.

Jump to

Keyboard shortcuts

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