syslog

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

README

The Syslog Backend for Deck

The syslog backend is based on Go's core log/syslog package, allowing log messages to be written to the system log service.

The syslog backend does not support Windows.

Init

The syslog backend takes two setup parameters, tag and facility.

The tag parameter allows the caller to supply a fixed prefix to log messages. This is passed directly to the underlying syslog package.

The facility parameter allows the caller to specify the syslog facility and severity. This is passed directly to the underlying syslog package.

Attributes

The syslog backend does not utilize any custom attributes.

Usage

import (
  github.com/google/deck
  github.com/google/deck/backends/syslog
)

...
func main() {
  sl, err := syslog.Init("MY-APP", syslog.LOG_INFO|syslog.LOG_USER)
  if err != nil {
    os.Exit(1)
  }
  deck.Add(sl)
}

Documentation

Overview

Package syslog provides a deck backend for syslog.

Index

Constants

View Source
const (
	LOG_EMERG   = syslog.LOG_EMERG
	LOG_ALERT   = syslog.LOG_ALERT
	LOG_CRIT    = syslog.LOG_CRIT
	LOG_ERR     = syslog.LOG_ERR
	LOG_WARNING = syslog.LOG_WARNING
	LOG_NOTICE  = syslog.LOG_NOTICE
	LOG_INFO    = syslog.LOG_INFO
	LOG_DEBUG   = syslog.LOG_DEBUG

	LOG_KERN     = syslog.LOG_KERN
	LOG_USER     = syslog.LOG_USER
	LOG_MAIL     = syslog.LOG_MAIL
	LOG_DAEMON   = syslog.LOG_DAEMON
	LOG_AUTH     = syslog.LOG_AUTH
	LOG_SYSLOG   = syslog.LOG_SYSLOG
	LOG_LPR      = syslog.LOG_LPR
	LOG_NEWS     = syslog.LOG_NEWS
	LOG_UUCP     = syslog.LOG_UUCP
	LOG_CRON     = syslog.LOG_CRON
	LOG_AUTHPRIV = syslog.LOG_AUTHPRIV
	LOG_FTP      = syslog.LOG_FTP
	LOG_LOCAL0   = syslog.LOG_LOCAL0
	LOG_LOCAL1   = syslog.LOG_LOCAL1
	LOG_LOCAL2   = syslog.LOG_LOCAL2
	LOG_LOCAL3   = syslog.LOG_LOCAL3
	LOG_LOCAL4   = syslog.LOG_LOCAL4
	LOG_LOCAL5   = syslog.LOG_LOCAL5
	LOG_LOCAL6   = syslog.LOG_LOCAL6
	LOG_LOCAL7   = syslog.LOG_LOCAL7
)

Priority values passed through from the underlying syslog package.

Variables

This section is empty.

Functions

This section is empty.

Types

type Syslog

type Syslog struct {
	// contains filtered or unexported fields
}

Syslog is a log deck backend that passes logs through to the syslog package.

func Init

func Init(tag string, facility syslog.Priority) (*Syslog, error)

Init initializes the Syslog backend for use in a deck.

func (*Syslog) Close

func (s *Syslog) Close() error

Close closes the syslog backend.

func (*Syslog) New

func (s *Syslog) New(lvl deck.Level, msg string) deck.Composer

New creates a new Syslog message.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL