syslog

package
v0.2.1-0...-a6904e9 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2015 License: MIT, MIT Imports: 9 Imported by: 0

README

dcounter

GoDoc

syslog is a simple io.Writer that writes to syslog over a network connection. The difference with the buildin syslog package is that it will detect the priority based on [ERR] [WARN] or [INFO] tags.

The main usage of this package is to import it for the side effects cause by setting the SYSLOG environment variable. Setting this variable will change the default writer of the log package.

SYSLOG should be set to network:address, for example udp:localhost:514

Installation

$ go get github.com/atomx/syslog
Usage
package main

import (
  "log"
  "os"
  "path"

  "github.com/atomx/syslog"
)

func main() {
  log.SetOutput(syslog.New("udp", "localhost:514", path.Base(os.Args[0])))

  log.Printf("[ERR] this will be logged with the error severity")
}

Documentation

Overview

syslog is a simple io.Writer that writes to syslog over a network connection. The difference with the buildin syslog package is that it will detect the priority based on [ERR] [WARN] or INFO tags.

The main usage of this package is to import it for the side effects cause by setting the SYSLOG environment variable. Setting this variable will change the default writer of the log package.

SYSLOG should be set to network:address, for example udp:localhost:514

Index

Constants

View Source
const (
	ALERT   = 1
	ERROR   = 3
	WARNING = 4
	INFO    = 5
)

See: http://en.wikipedia.org/wiki/Syslog#Severity_levels

Variables

This section is empty.

Functions

This section is empty.

Types

type Syslog

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

func New

func New(network, address, tag string) *Syslog

func (*Syslog) Write

func (sl *Syslog) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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