Documentation ¶
Overview ¶
Package syslog provides easy to use interface for syslog logging system
Index ¶
- func Alert(msg string)
- func Alertf(format string, a ...interface{})
- func Closelog()
- func Crit(msg string)
- func Critf(format string, a ...interface{})
- func Debug(msg string)
- func Debugf(format string, a ...interface{})
- func Emerg(msg string)
- func Emergf(format string, a ...interface{})
- func Err(msg string)
- func Errf(format string, a ...interface{})
- func Info(msg string)
- func Infof(format string, a ...interface{})
- func Notice(msg string)
- func Noticef(format string, a ...interface{})
- func Openlog(ident string, o Option, p Priority)
- func Syslog(p Priority, msg string)
- func Syslogf(p Priority, format string, a ...interface{})
- func Warning(msg string)
- func Warningf(format string, a ...interface{})
- type LogMask
- type Option
- type Priority
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Alertf ¶
func Alertf(format string, a ...interface{})
Formats according to a format specifier and writes to syslog with log level ALERT
func Closelog ¶
func Closelog()
Closes the current Syslog connection, if there is one. This includes closing the /dev/log socket, if it is open. Closelog also sets the identification string for Syslog messages back to the default,
func Critf ¶
func Critf(format string, a ...interface{})
Formats according to a format specifier and writes to syslog with log level CRIT
func Debugf ¶
func Debugf(format string, a ...interface{})
Formats according to a format specifier and writes to syslog with log level DEBUG
func Emergf ¶
func Emergf(format string, a ...interface{})
Formats according to a format specifier and writes to syslog with log level EMERG
func Errf ¶
func Errf(format string, a ...interface{})
Formats according to a format specifier and writes to syslog with log level ERR
func Infof ¶
func Infof(format string, a ...interface{})
Formats according to a format specifier and writes to syslog with log level INFO
func Noticef ¶
func Noticef(format string, a ...interface{})
Formats according to a format specifier and writes to syslog with log level NOTICE
func Openlog ¶
Opens or reopens a connection to Syslog in preparation for submitting messages. See http://www.gnu.org/software/libc/manual/html_node/openlog.html for parameters description
func Syslog ¶
Writes msg to syslog with facility and priority indicated by parameter "p" You can combine facility and priority with bitwise or operator, e.g. : syslog.Syslog( syslog.LOG_INFO | syslog.LOG_USER, "Hello syslog")
Types ¶
type LogMask ¶
type LogMask int
LogMask is a bit string with one bit corresponding to each of the possible message priorities. If the bit is on, syslog handles messages of that priority normally. If it is off, syslog discards messages of that priority Use LOG_MASK and LOG_UPTO to construct an appropriate mask value
func LOG_UPTO ¶
Generates a mask with the bits on for a certain priority and all priorities above it The unfortunate naming is due to the fact that internally, higher numbers are used for lower message priorities.
func SetLogMask ¶
Sets this logmask for the calling process, and returns the previous mask. If the mask argument is 0, the current logmask is not modified. Example: syslog.SetLogMask( syslog.LOG_MASK(LOG_EMERG) | syslog.LOG_MASK(LOG_ERROR) )
type Priority ¶
type Priority int
const ( // From /usr/include/sys/syslog.h. // These are the same up to LOG_FTP on Linux, BSD, and OS X. LOG_KERN Priority = iota << 3 LOG_USER LOG_MAIL LOG_DAEMON LOG_AUTH LOG_SYSLOG LOG_LPR LOG_NEWS LOG_UUCP LOG_CRON LOG_AUTHPRIV LOG_FTP LOG_LOCAL0 LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 )