Categorygithub.com/digitalrebar/logger
modulepackage
1.0.2
Repository: https://github.com/digitalrebar/logger.git
Documentation: pkg.go.dev

# README

Logger implements a shared logging infrastructure. It add several features on top of the standard logging package:

  • The usual log levels, from trace up to panic.
  • Logs are created for named services, each of which can log at its own log level.
  • Eacch log has a group number that can be used to group related log entries.
  • Each log entry has a globally unique sequence number that can be used to reconstruct the order in which log entries were generated even in the face of out-of-order log recording.
  • Logs can have callback functions registered for them to facilitate sending log entries as events.

# Packages

hcl implements compatibility with github.com/hashicorp/go-hclog.

# Functions

New returns a new Buffer which will write to the passed-in Local logger.
ParseLevel returns the log level appropriate for the passed in string.

# Constants

Audit logs must always be printed.
Debug should be useful for debugging low-level problems that do not necessarily require the level of detail that Trace provides.
Error should be used to signal when something unusal happened that could not be handled gracefully, but that did not result in a condition where we had to shut down.
Fatal should be used where we need to shut down the program in order to avoid data corruption, and there is no possibility of handling in a programmatic fashion.
Info should be used to emit information messages that do not signal an unusual condition.
Panic should be used where we need to abort whatever is happening, and there is a possibility of handling or avoiding the error in a programmatic fashion.
Trace should be used when you want detailed log messages that map to the actual flow of control through the program.
Warn should be used to signal when something unusual happened that the program was able to handle appropriatly.

# Structs

Buffer is a ringbuffer that can be shared among several different Loggers.
Line is the smallest unit of things we log.

# Interfaces

Local allows us to accept as a local logger anything that has the usual basic logging methods.
Logger is the interface that users of this package should expect.

# Type aliases

Level is a log level.
Publisher is a function to be called whenever a Line would be added to the ring buffer and sent to the local logger.