syslog: github.com/blackjack/syslog Index | Files

package syslog

import "github.com/blackjack/syslog"

Package syslog provides easy to use interface for syslog logging system

Index

Package Files

functions.go logmask.go syslog.go writer.go

func Alert Uses

func Alert(msg string)

Writes syslog message with log level ALERT

func Alertf Uses

func Alertf(format string, a ...interface{})

Formats according to a format specifier and writes to syslog with log level ALERT

func Closelog Uses

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 Crit Uses

func Crit(msg string)

Writes syslog message with log level CRIT

func Critf Uses

func Critf(format string, a ...interface{})

Formats according to a format specifier and writes to syslog with log level CRIT

func Debug Uses

func Debug(msg string)

Writes syslog message with log level DEBUG

func Debugf Uses

func Debugf(format string, a ...interface{})

Formats according to a format specifier and writes to syslog with log level DEBUG

func Emerg Uses

func Emerg(msg string)

Writes syslog message with log level EMERG

func Emergf Uses

func Emergf(format string, a ...interface{})

Formats according to a format specifier and writes to syslog with log level EMERG

func Err Uses

func Err(msg string)

Writes syslog message with log level ERR

func Errf Uses

func Errf(format string, a ...interface{})

Formats according to a format specifier and writes to syslog with log level ERR

func Info Uses

func Info(msg string)

Writes syslog message with log level INFO

func Infof Uses

func Infof(format string, a ...interface{})

Formats according to a format specifier and writes to syslog with log level INFO

func Notice Uses

func Notice(msg string)

Writes syslog message with log level NOTICE

func Noticef Uses

func Noticef(format string, a ...interface{})

Formats according to a format specifier and writes to syslog with log level NOTICE

func Openlog Uses

func Openlog(ident string, o Option, p Priority)

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 Uses

func Syslog(p Priority, msg string)

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")

func Syslogf Uses

func Syslogf(p Priority, format string, a ...interface{})

Formats according to a format specifier and writes to syslog with facility and priority indicated by parameter "p"

func Warning Uses

func Warning(msg string)

Writes syslog message with log level WARNING

func Warningf Uses

func Warningf(format string, a ...interface{})

Formats according to a format specifier and writes to syslog with log level WARNING

type LogMask Uses

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_MASK Uses

func LOG_MASK(p Priority) LogMask

Mask for one priority

func LOG_UPTO Uses

func LOG_UPTO(p Priority) LogMask

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 Uses

func SetLogMask(p LogMask) LogMask

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 Option Uses

type Option int
const (
    //Option
    LOG_PID    Option = 0x01
    LOG_CONS   Option = 0x02
    LOG_NDELAY Option = 0x08
    LOG_NOWAIT Option = 0x10
    LOG_PERROR Option = 0x20
)

type Priority Uses

type Priority int
const (
    LOG_EMERG Priority = iota
    LOG_ALERT
    LOG_CRIT
    LOG_ERR
    LOG_WARNING
    LOG_NOTICE
    LOG_INFO
    LOG_DEBUG
)
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
)

type Writer Uses

type Writer struct {
    LogPriority Priority
}

An io.Writer() interface

func (*Writer) Write Uses

func (w *Writer) Write(b []byte) (int, error)

Package syslog imports 4 packages (graph) and is imported by 8 packages. Updated 2016-11-10. Refresh now. Tools for package owners.