vic: Index | Files

package syslog

import ""


Package Files

dialer.go formatter.go hook.go syslog.go syslog_unix.go writer.go


var Logger = logrus.New()

Logger is the logger object used by the package

func MakeTag Uses

func MakeTag(prefix, proc string) string

MakeTag returns prfeix + sep + proc if prefix is not empty. If proc is empty, proc is set to filepath.Base(os.Args[0]). If prefix is empty, MakeTag returns proc.

type Format Uses

type Format int

Format is the syslog format, e.g. RFC 3164

const (
    RFC3164 Format = iota

type Hook Uses

type Hook struct {
    // contains filtered or unexported fields

func NewHook Uses

func NewHook(network, raddr string, priority Priority, tag string) (*Hook, error)

func (*Hook) Fire Uses

func (hook *Hook) Fire(entry *logrus.Entry) error

func (*Hook) Levels Uses

func (hook *Hook) Levels() []logrus.Level

type Priority Uses

type Priority int

Priority is a combination of the syslog facility and severity. For example, Alert | Ftp sends an alert severity message from the FTP facility. The default severity is Emerg; the default facility is Kern.

const (

    // From /usr/include/sys/syslog.h.
    // These are the same on Linux, BSD, and OS X.
    Emerg   Priority = iota // LOG_EMERG
    Alert                   // LOG_ALERT
    Crit                    // LOG_CRIT
    Err                     // LOG_ERR
    Warning                 // LOG_WARNING
    Notice                  // LOG_NOTICE
    Info                    // LOG_INFO
    Debug                   // LOG_DEBUG
const (

    // From /usr/include/sys/syslog.h.
    // These are the same up to LOG_FTP on Linux, BSD, and OS X.
    Kern     Priority = iota << 3 // LOG_KERN
    User                          // LOG_USER
    Mail                          // LOG_MAIL
    Daemon                        // LOG_DAEMON
    Auth                          // LOG_AUTH
    Syslog                        // LOG_SYSLOG
    Lpr                           // LOG_LPR
    News                          // LOG_NEWS
    Uucp                          // LOG_UUCP
    Cron                          // LOG_CRON
    Authpriv                      // LOG_AUTHPRIV
    Ftp                           // LOG_FTP

    Local0 // LOG_LOCAL0
    Local1 // LOG_LOCAL1
    Local2 // LOG_LOCAL2
    Local3 // LOG_LOCAL3
    Local4 // LOG_LOCAL4
    Local5 // LOG_LOCAL5
    Local6 // LOG_LOCAL6
    Local7 // LOG_LOCAL7

type Writer Uses

type Writer interface {

    Emerg(string) error
    Crit(string) error
    Err(string) error
    Warning(string) error
    Info(string) error
    Debug(string) error

    WithTag(tag string) Writer
    WithPriority(priority Priority) Writer

func Dial Uses

func Dial(network, raddr string, priority Priority, tag string) (Writer, error)

Dial establishes a connection to a log daemon by connecting to address raddr on the specified network. Each write to the returned writer sends a log message with the given facility, severity and tag. If network is empty, Dial will connect to the local syslog server.

func New Uses

func New(priority Priority, tag string) (Writer, error)

New establishes a new connection to the system log daemon. Each write to the returned writer sends a log message with the given priority and prefix.

Package syslog imports 10 packages (graph) and is imported by 8 packages. Updated 2017-08-21. Refresh now. Tools for package owners.