Documentation
¶
Overview ¶
SystemD journal support based on CoreOS Implementation Copyright © 2015 CoreOS, Inc. License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0
Other drivers written from scratch and MIT-licensed.
simple logging framework for go with support for syslog, file (including os.Stderr) and SystemD journal.
Copyright © 2019 Dmitry V. Papchenkoff
Index ¶
- func Alert(message string) error
- func Alertf(format string, args ...interface{}) error
- func Configured() bool
- func Crit(message string) error
- func Critf(format string, args ...interface{}) error
- func Debug(message string) error
- func Debugf(format string, args ...interface{}) error
- func Emerg(message string) error
- func Emergf(format string, args ...interface{}) error
- func Err(message string) error
- func Errf(format string, args ...interface{}) error
- func Info(message string) error
- func Infof(format string, args ...interface{}) error
- func Log(priority Priority, depth int, message string) error
- func Logf(priority Priority, depth int, format string, args ...interface{}) error
- func Must(args ...interface{}) check.Values
- func Must2(arg0, arg1 interface{}) interface{}
- func Notice(message string) error
- func Noticef(format string, args ...interface{}) error
- func Panic(condition interface{}, args ...interface{})
- func Trace(depth int) (file string, line int, fun string, ok bool)
- func Warning(message string) error
- func Warningf(format string, args ...interface{}) error
- type Driver
- type DrvFile
- type DrvJournal
- type DrvSyslog
- type Priority
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Logf ¶
Common function for sending log message with selected priority.
depth used for trace as in log.Output in standard logger. Uses fmt.Sprintf()
func Must ¶
calls Panic() on last arg, returns remaining does nothing if no args given, returns nil if less than 2 args
func Must2 ¶
func Must2(arg0, arg1 interface{}) interface{}
calls Panic(arg1), returns arg0, useful for one-line type-assertion
func Panic ¶
func Panic(condition interface{}, args ...interface{})
Logs error and calls panic() if condition is non-nil error, true bool or any other type.
optional arguments, if given, must start from string and will be passed to fmt.Sprintf
Types ¶
type Driver ¶
Common driver type. Rotate() implemented only for file drivers. On other drivers Rotate() always returns nil and does nothing.
func ConfigureFile ¶
Configures file log output. Uses os.Stderr if path is "", stdPriority is used for redirected standard logger. Output format is syslog-like, but shows priority instead of tag and pid. Output columns delimited by \t, so you can easily parse output with cut and other such tools.
func ConfigureJournal ¶
Configures output to systemd journal, stdPriority used for standard logger
func ConfigureSyslog ¶
func ConfigureSyslog(network, raddr string, stdPriority syslog.Priority, tag string) (Driver, error)
Configures output to syslog, args passed to syslog.Dial(), stdPriority used for redirected standard logger
func ConfigureSyslogDefault ¶
Configures output to syslog with default values (LOG_DAEMON facility, LOG_WARNING priority for standard logger)
type DrvFile ¶
type DrvFile struct {
// contains filtered or unexported fields
}
file driver type
func (*DrvFile) Close ¶
Closes output file and switches output to stderr, does nothing if it's already stderr
type DrvJournal ¶
type DrvJournal struct {
// contains filtered or unexported fields
}
type for journal driver