Documentation ¶
Index ¶
- Constants
- func Debug(format string, v ...interface{})
- func EnableMemoryLogger(logs []*MemoryLogger)
- func EnableNamedSyslog(name string)
- func EnableStderr(plainText bool)
- func EnableSyslog()
- func Error(format string, v ...interface{})
- func Info(format string, v ...interface{})
- func ResetColors()
- func SetLogLevel(level uint)
- func Warning(format string, v ...interface{})
- type LogEntry
- type MemoryLogger
- type TerminalLogger
Constants ¶
const ( // DebugLevel is the most detailed logging level. It will emit all log levels. DebugLevel uint = iota // InfoLevel is the log level that will log info, warning and errors InfoLevel // WarningLevel is the log level that will log warnings and errors WarningLevel // ErrorLevel is the log level that only logs errors ErrorLevel )
const MemoryLoggerFlags = log.Lshortfile
MemoryLoggerFlags is the assumed layout for the log
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(format string, v ...interface{})
Debug adds a debug-level log message to the log. If the log level is set higher than DebugLevel the message will be discarded.
func EnableMemoryLogger ¶
func EnableMemoryLogger(logs []*MemoryLogger)
EnableMemoryLogger turns on logging to a memory logger.
func EnableNamedSyslog ¶
func EnableNamedSyslog(name string)
EnableNamedSyslog enables sending logs to syslog with the given name.
func EnableSyslog ¶
func EnableSyslog()
EnableSyslog enables syslog logging with the name "congress"
func Error ¶
func Error(format string, v ...interface{})
Error adds an error-level log message to the log.
Types ¶
type LogEntry ¶
LogEntry is a linked list entry that holds log entries
func NewLogEntry ¶
NewLogEntry creates a new log entry
type MemoryLogger ¶
type MemoryLogger struct { FirstEntry *LogEntry LastEntry *LogEntry // contains filtered or unexported fields }
MemoryLogger is a type that logs to memory. The logs are stored in a linked list.
func NewMemoryLogger ¶
func NewMemoryLogger(maxEntries int, l uint) *MemoryLogger
NewMemoryLogger creates a new memory logger
func NewMemoryLoggers ¶
func NewMemoryLoggers(maxEntries int) []*MemoryLogger
NewMemoryLoggers is a convenience function to create logs for all levels
func (*MemoryLogger) Entries ¶
func (m *MemoryLogger) Entries() []LogEntry
Entries returns the entries
func (*MemoryLogger) Merge ¶
func (m *MemoryLogger) Merge(other ...*MemoryLogger) []LogEntry
Merge merges this and a number of other logs
func (*MemoryLogger) NumEntries ¶
func (m *MemoryLogger) NumEntries() int
NumEntries returns the number of entries in the log in total. This is increased for every time something is logged to the logger.
type TerminalLogger ¶
type TerminalLogger struct {
// contains filtered or unexported fields
}
TerminalLogger is a logger that creates a console logging screen with logs that can be toggled runtime.
func NewTerminalLogger ¶
func NewTerminalLogger(logs []*MemoryLogger) *TerminalLogger
NewTerminalLogger creates a new TerminalLogger instance using the specified MemoryLogger instances.
func (*TerminalLogger) Start ¶
func (t *TerminalLogger) Start() error
Start launches the logging screen. If there's an error launching the screen it will be returned. The method doesn't return until the user presses the escape key.