axsyslog

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package syslog provides a wrapper for system log functionality, allowing for logging messages with various priorities and optional console output.

Index

Constants

View Source
const (
	LOG_PID  = 0x01
	LOG_CONS = 0x02
	LOG_USER = (1 << 3)

	LOG_INFO = 6
	LOG_CRIT = 2
	LOG_WARN = 4
	LOG_ERR  = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Syslog

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

Syslog struct holds the identifier pointer for syslog entries and a flag to enable or disable console logging.

func NewSyslog

func NewSyslog(ident string, option int, facility int) *Syslog

NewSyslog initializes a new syslog handler with the specified identifier, option, and facility. Console logging is disabled by default. - `ident` is a string that identifies the messages in the log. - `option` is an integer specifying logging options (e.g., LOG_PID, LOG_CONS). - `facility` is an integer specifying the syslog facility.

func (*Syslog) Close

func (s *Syslog) Close()

Close releases resources associated with the syslog, specifically freeing the identifier.

func (*Syslog) Crit

func (s *Syslog) Crit(message string)

Crit logs a critical message to the syslog and panics. The message is also logged to the console if console logging is enabled.

func (*Syslog) Critf

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

Critf logs a critical message, formatted according to a format specifier, to the syslog and panics. The message is also logged to the console if console logging is enabled.

func (*Syslog) DisableConsole

func (s *Syslog) DisableConsole()

DisableConsole disables logging to the console for this syslog instance.

func (*Syslog) EnableConsole

func (s *Syslog) EnableConsole()

EnableConsole enables logging to the console for this syslog instance.

func (*Syslog) Error

func (s *Syslog) Error(message string)

Error logs an error message to the syslog, and optionally to the console.

func (*Syslog) Errorf

func (s *Syslog) Errorf(format string, a ...interface{})

Errorf logs an error message, formatted according to a format specifier, to the syslog, and optionally to the console.

func (*Syslog) Info

func (s *Syslog) Info(message string)

Info logs an informational message to the syslog, and optionally to the console.

func (*Syslog) Infof

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

Infof logs an informational message, formatted according to a format specifier, to the syslog, and optionally to the console.

func (*Syslog) Log

func (s *Syslog) Log(priority int, message string)

Log sends a log message with the specified priority to the syslog, and optionally to the console if console logging is enabled. - `priority` is an integer specifying the message's priority (e.g., LOG_INFO, LOG_ERR). - `message` is the string message to log.

func (*Syslog) Warn

func (s *Syslog) Warn(message string)

Warn logs a warning message to the syslog, and optionally to the console.

func (*Syslog) Warnf

func (s *Syslog) Warnf(format string, a ...interface{})

Warnf logs a warning message, formatted according to a format specifier, to the syslog, and optionally to the console.

Jump to

Keyboard shortcuts

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