logger

package
v1.2.3-testnet Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: ISC Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BackendLog is the logging backend used to create all subsystem loggers.
	BackendLog = logs.NewBackend()
)

Loggers per subsystem. A single backend logger is created and all subsytem loggers created from it will write to the backend. When adding new subsystems, add the subsystem logger variable here and to the subsystemLoggers map.

Loggers can not be used before the log rotator has been initialized with a log file. This must be performed early during application startup by calling InitLog.

View Source
var SubsystemTags = struct {
	ADXR,
	AMGR,
	CMGR,
	BCDB,
	BTCD,
	BDAG,
	CNFG,
	DISC,
	INDX,
	MINR,
	PEER,
	RPCS,
	SCRP,
	SRVR,
	SYNC,
	TXMP,
	UTIL string
}{
	ADXR: "ADXR",
	AMGR: "AMGR",
	CMGR: "CMGR",
	BCDB: "BCDB",
	BTCD: "BTCD",
	BDAG: "BDAG",
	CNFG: "CNFG",
	DISC: "DISC",
	INDX: "INDX",
	MINR: "MINR",
	PEER: "PEER",
	RPCS: "RPCS",
	SCRP: "SCRP",
	SRVR: "SRVR",
	SYNC: "SYNC",
	TXMP: "TXMP",
	UTIL: "UTIL",
}

SubsystemTags is an enum of all sub system tags

Functions

func DirectionString

func DirectionString(inbound bool) string

DirectionString is a helper function that returns a string that represents the direction of a connection (inbound or outbound).

func Get

func Get(tag string) (logger logs.Logger, ok bool)

Get returns a logger of a specific sub system

func InitLog

func InitLog(logFile, errLogFile string)

InitLog attaches log file and error log file to the backend log.

func ParseAndSetDebugLevels

func ParseAndSetDebugLevels(debugLevel string) error

ParseAndSetDebugLevels attempts to parse the specified debug level and set the levels accordingly. An appropriate error is returned if anything is invalid.

func PickNoun

func PickNoun(n uint64, singular, plural string) string

PickNoun returns the singular or plural form of a noun depending on the count n.

func SetLogLevel

func SetLogLevel(subsystemID string, logLevel string)

SetLogLevel sets the logging level for provided subsystem. Invalid subsystems are ignored. Uninitialized subsystems are dynamically created as needed.

func SetLogLevels

func SetLogLevels(logLevel string)

SetLogLevels sets the log level for all subsystem loggers to the passed level. It also dynamically creates the subsystem loggers as needed, so it can be used to initialize the logging system.

func SupportedSubsystems

func SupportedSubsystems() []string

SupportedSubsystems returns a sorted slice of the supported subsystems for logging purposes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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