Documentation ¶
Index ¶
Constants ¶
const ( LogRoot = "/var/log/" + config.OrchestratorName LogRotationThreshold = 10485760 // 10 MB MaxLogEntryLength = 64000 RandomLogcheckEnvVar = "LOGROTATE_FREQUENCY" )
const ( TextFormat = "text" JSONFormat = "json" )
Variables ¶
This section is empty.
Functions ¶
func InitLogFormat ¶
InitLogFormat configures the log format, allowing a choice of text or JSON.
func InitLogLevel ¶
InitLogLevel configures the logging level. The debug flag takes precedence if set, otherwise the logLevel flag (debug, info, warn, error, fatal) is used.
func InitLoggingForDocker ¶
InitLoggingForDocker configures logging for nDVP. Logs are written both to a log file as well as stdout/stderr. Since logrus doesn't support multiple writers, each log stream is implemented as a hook.
Types ¶
type ConsoleHook ¶
type ConsoleHook struct {
// contains filtered or unexported fields
}
ConsoleHook sends log entries to stdout.
func NewConsoleHook ¶
func NewConsoleHook(logFormat string) (*ConsoleHook, error)
NewConsoleHook creates a new log hook for writing to stdout/stderr.
func (*ConsoleHook) Levels ¶
func (hook *ConsoleHook) Levels() []log.Level
type FileHook ¶
type FileHook struct {
// contains filtered or unexported fields
}
FileHook sends log entries to a file.
func NewFileHook ¶
NewFileHook creates a new log hook for writing to a file.
func (*FileHook) GetLocation ¶
type JSONFormatter ¶
type PlainTextFormatter ¶
type PlainTextFormatter struct { // TimestampFormat to use for display when a full timestamp is printed TimestampFormat string // The fields are sorted by default for a consistent output. For applications // that log extremely frequently and don't use the JSON formatter this may not // be desired. DisableSorting bool }
PlainTextFormatter is a formatter than does no coloring *and* does not insist on writing logs as key/value pairs.