Documentation
¶
Index ¶
Constants ¶
View Source
const ( // LevelDebug logs all messages. LevelDebug uint16 = iota // LevelInfo logs only informational messages and any others with greater severity. LevelInfo // LevelSuccess logs only success messages and any others with greater severity. LevelSuccess // LevelWarn logs only warning messages and any others with greater severity. LevelWarn // LevelError logs only error messages and any others with greater severity. LevelError // LevelFatal logs only fatal messages. LevelFatal // ConsoleLogger creates a new console logger when used in NewLogger(). ConsoleLogger // FileLogger creates a new file logger when used in NewLogger(). FileLogger // TransientLogger like consoleLogger TransientLogger )
Variables ¶
This section is empty.
Functions ¶
func DisableColor ¶
func DisableColor()
DisableColor disables color output to the terminal for console loggers. Log levels can still be differentiated by their prefixes.
func Initialize ¶
func NumericalLevel ¶
Types ¶
type Logger ¶
type Logger interface {
// Fatal is used when an application encounters a critical error, requiring
// a shutdown.
Fatal(format string, v ...interface{})
// Error is used when a non-fatal error is raised.
Error(format string, v ...interface{})
// Warn is typically used to warn about errors that an application doesn't necessarily
// have to shut down for.
Warn(format string, v ...interface{})
// Success is used when an operation completes successfully.
Success(format string, v ...interface{})
// Info is used for useful application notifications, such as an operation
// completed successfully, or network operations such as received / sent requests and
// responses.
Info(format string, v ...interface{})
// Debug is used for debug messages.
Debug(format string, v ...interface{})
// SetLogLevel determines which messages are logged based on their severity. For
// example, a developer (or user) may choose to not log benign messages (debug, info)
// to reduce noise.
SetLogLevel(logLevel uint16) error
// Close closes the logger and performs any necessary cleanup routines.
Close() error
}
Logger interface declares methods used by both console loggers and file loggers. Console loggers display their output to the user, while file loggers write the output to a file. This functionality is useful for high volume and/or less urgent log messages, such as failed requests or other information.
Click to show internal directories.
Click to hide internal directories.