Documentation ¶
Overview ¶
Package log prints messages to a given writer, /dev/log, /dev/kmsg, or a byte buffer until one of these are available.
Index ¶
Constants ¶
const DevKmsg = "/dev/kmsg"
const DevLog = "/dev/log"
const FacilityMask = ^PriorityMask
const License = `` /* 15871-byte string literal not displayed */
const PriorityMask = syslog.Priority(7)
const Version = "v1.1.0"
Version format :: v<MAJOR>.<MINOR>.<PATCH>[-rc<CANDIDATE>]
Variables ¶
var FacilityByName = map[string]syslog.Priority{ "kern": syslog.LOG_KERN, "user": syslog.LOG_USER, "mail": syslog.LOG_MAIL, "daemon": syslog.LOG_DAEMON, "auth": syslog.LOG_AUTH, "syslog": syslog.LOG_SYSLOG, "lpr": syslog.LOG_LPR, "news": syslog.LOG_NEWS, "uucp": syslog.LOG_UUCP, "cron": syslog.LOG_CRON, "priv": syslog.LOG_AUTHPRIV, "ftp": syslog.LOG_FTP, "local0": syslog.LOG_LOCAL0, "local1": syslog.LOG_LOCAL1, "local2": syslog.LOG_LOCAL2, "local3": syslog.LOG_LOCAL3, "local4": syslog.LOG_LOCAL4, "local5": syslog.LOG_LOCAL5, "local6": syslog.LOG_LOCAL6, "local7": syslog.LOG_LOCAL7, }
var LogFacilityByValue = map[syslog.Priority]string{ syslog.LOG_KERN: "kern", syslog.LOG_USER: "user", syslog.LOG_MAIL: "mail", syslog.LOG_DAEMON: "daemon", syslog.LOG_AUTH: "auth", syslog.LOG_SYSLOG: "syslog", syslog.LOG_LPR: "lpr", syslog.LOG_NEWS: "news", syslog.LOG_UUCP: "uucp", syslog.LOG_CRON: "cron", syslog.LOG_AUTHPRIV: "priv", syslog.LOG_FTP: "ftp", syslog.LOG_LOCAL0: "local0", syslog.LOG_LOCAL1: "local1", syslog.LOG_LOCAL2: "local2", syslog.LOG_LOCAL3: "local3", syslog.LOG_LOCAL4: "local4", syslog.LOG_LOCAL5: "local5", syslog.LOG_LOCAL6: "local6", syslog.LOG_LOCAL7: "local7", }
Functions ¶
func LinesFrom ¶
func LinesFrom(rc io.ReadCloser, id, priority string)
log lines from the given reader until EOF or error.
func Print ¶
func Print(args ...interface{})
The default level is: Debug, User. Upto the first two arguments may change this by name; e.g.
Print("daemon", ...) Print("daemon", "err", ...) Print("err", ...)
Types ¶
type Limited ¶
Limited provides a logger with Print and Printf restricted to the given iterations.
func NewLimited ¶
NewLimited returns a logger with the given iteration restriction.
type RateLimited ¶
type RateLimited struct { *Limited // contains filtered or unexported fields }
RateLimited provides a logger with Print and Printf restricted to the given iterations per unit time. This must be created with NewRateLimited and destroyed with (*RateLimited).Close().
func NewRateLimited ¶
func NewRateLimited(n uint32, d time.Duration) *RateLimited
NewRateLimited returns a logger restricted to the given iterations per unit time that should be destroyed with `defer (*RateLimited).Close()`
func (*RateLimited) Close ¶
func (p *RateLimited) Close() error