log

package
v0.0.0-...-a367121 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2015 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Daemons need to log. This package makes that easy, allowing you to configure logging to syslog, a file, or console (stdout), with syslog style log levels.

Since this logging mechanism supports non-syslog output, filtering based on log levels is done in-application, so you'll want to accept debug messages and above in syslog configs.

Simply call SetupLogging(), passing it a reference to a LogConfig struct and start logging! If you happen to log something prior to setting up logging, messages will print to stderr.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert

func Alert(msg string, args ...interface{})

Logs an Alert message. Supports fmt.Sprintf style arguments.

func Crit

func Crit(msg string, args ...interface{})

Logs a Crit message. Supports fmt.Sprintf style arguments.

func Debug

func Debug(msg string, args ...interface{})

Logs a Debug message. Supports fmt.Sprintf style arguments.

func Emerg

func Emerg(msg string, args ...interface{})

Logs an Emerg message. Supports fmt.Sprintf style arguments.

func Error

func Error(msg string, args ...interface{})

Logs an Error message. Supports fmt.Sprintf style arguments.

func Info

func Info(msg string, args ...interface{})

Logs an Info message. Supports fmt.Sprintf style arguments.

func Notice

func Notice(msg string, args ...interface{})

Logs a Notice message. Supports fmt.Sprintf style arguments.

func SetupLogging

func SetupLogging(cfg LogConfig)

Does the needful to set up the logging subsystem based on the passed configuration data.

func Warn

func Warn(msg string, args ...interface{})

Logs a Warning message. Supports fmt.Sprintf style arguments.

Types

type LogConfig

type LogConfig struct {
	Type     string // logging mode to use - file, syslog, console
	Level    string // Syslog level to log at (debug, info, notice, error, etc)
	Facility string // Syslog facility to log to (daemon, misc, etc)
	File     string // Path that will be logged to if in file mode
}

Jump to

Keyboard shortcuts

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