Documentation
¶
Overview ¶
Package penlogger implements the penlog(7) specification.
Index ¶
- Constants
- func Colorize(color, s string) string
- type HRDialect
- type HRFormatter
- type Logger
- func (l *Logger) Log(msg map[string]interface{})
- func (l *Logger) LogCritical(v ...interface{})
- func (l *Logger) LogCriticalTagged(tags []string, v ...interface{})
- func (l *Logger) LogCriticalTaggedf(tags []string, format string, v ...interface{})
- func (l *Logger) LogCriticalf(format string, v ...interface{})
- func (l *Logger) LogDebug(v ...interface{})
- func (l *Logger) LogDebugTagged(tags []string, v ...interface{})
- func (l *Logger) LogDebugTaggedf(tags []string, format string, v ...interface{})
- func (l *Logger) LogDebugf(format string, v ...interface{})
- func (l *Logger) LogError(v ...interface{})
- func (l *Logger) LogErrorTagged(tags []string, v ...interface{})
- func (l *Logger) LogErrorTaggedf(tags []string, format string, v ...interface{})
- func (l *Logger) LogErrorf(format string, v ...interface{})
- func (l *Logger) LogInfo(v ...interface{})
- func (l *Logger) LogInfoTagged(tags []string, v ...interface{})
- func (l *Logger) LogInfoTaggedf(tags []string, format string, v ...interface{})
- func (l *Logger) LogInfof(format string, v ...interface{})
- func (l *Logger) LogMessage(msgType string, prio Prio, tags []string, v ...interface{})
- func (l *Logger) LogMessagef(msgType string, prio Prio, tags []string, format string, v ...interface{})
- func (l *Logger) LogNotice(v ...interface{})
- func (l *Logger) LogNoticef(format string, v ...interface{})
- func (l *Logger) LogTrace(v ...interface{})
- func (l *Logger) LogTraceTagged(tags []string, v ...interface{})
- func (l *Logger) LogTraceTaggedf(tags []string, format string, v ...interface{})
- func (l *Logger) LogTracef(format string, v ...interface{})
- func (l *Logger) LogWarning(v ...interface{})
- func (l *Logger) LogWarningTagged(tags []string, v ...interface{})
- func (l *Logger) LogWarningTaggedf(tags []string, format string, v ...interface{})
- func (l *Logger) LogWarningf(format string, v ...interface{})
- func (l *Logger) Print(v ...interface{})
- func (l *Logger) Printf(format string, v ...interface{})
- func (l *Logger) SetColors(enable bool)
- func (l *Logger) SetIncludeUUID(enabled bool)
- func (l *Logger) SetLevelPrefix(enable bool)
- func (l *Logger) SetLines(enable bool)
- func (l *Logger) SetLogLevel(prio Prio)
- func (l *Logger) SetStacktrace(enable bool)
- func (l *Logger) Write(p []byte) (int, error)
- type OutType
- type Prio
Constants ¶
const ( ColorNop = "" ColorReset = "\033[0m" ColorBold = "\033[1m" ColorRed = "\033[31m" ColorGreen = "\033[32m" ColorYellow = "\033[33m" ColorBlue = "\033[34m" ColorPurple = "\033[35m" ColorCyan = "\033[36m" ColorWhite = "\033[37m" ColorGray = "\033[0;38;5;245m" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HRFormatter ¶
type HRFormatter struct { Timespec string CompLen int TypeLen int LogFmt string LogLevel Prio ShowColors bool ShowLines bool ShowStacktraces bool ShowLevelPrefix bool ShowID bool ShowTags bool Dialect HRDialect }
func NewHRFormatter ¶
func NewHRFormatter() *HRFormatter
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) Log ¶
Log is the lowest level logging primitive. Any fields can be added to the emitted logging message. The penlog fields id, timestamp, timezone, component, host, line, and stacktrace are added by the underlying logic. Besides this any field can be added. Be aware of the mandatory fields in the penlog(7) specification. There might be dragons.
func (*Logger) LogCritical ¶
func (l *Logger) LogCritical(v ...interface{})
func (*Logger) LogCriticalTagged ¶
func (*Logger) LogCriticalTaggedf ¶
func (*Logger) LogCriticalf ¶
func (*Logger) LogDebugTagged ¶
func (*Logger) LogDebugTaggedf ¶
func (*Logger) LogErrorTagged ¶
func (*Logger) LogErrorTaggedf ¶
func (*Logger) LogInfoTagged ¶
func (*Logger) LogInfoTaggedf ¶
func (*Logger) LogMessage ¶
LogMessage is a higher level interface for emitting log messages. In contrast to Log it is not possible to emit invalid messages by accident. The following penlog fields are filled: data, type, priority tags. Tags might be nil.
func (*Logger) LogMessagef ¶
func (l *Logger) LogMessagef(msgType string, prio Prio, tags []string, format string, v ...interface{})
LogMessagef is the same as LogMessage except that it takes a Printf like format string and the relevant arguments.
func (*Logger) LogNoticef ¶
func (*Logger) LogTraceTagged ¶
func (*Logger) LogTraceTaggedf ¶
func (*Logger) LogWarning ¶
func (l *Logger) LogWarning(v ...interface{})