hslogger-1.2.9: Versatile logging framework

CopyrightCopyright (C) 2004-2011 John Goerzen
LicenseBSD3
MaintainerJohn Goerzen <jgoerzen@complete.org>
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell98

System.Log.Handler.Syslog

Contents

Description

Syslog handler for the Haskell Logging Framework

Written by John Goerzen, jgoerzen@complete.org

This module implements an interface to the Syslog service commonly found in Unix/Linux systems. This interface is primarily of interest to developers of servers, as Syslog does not typically display messages in an interactive fashion.

This module is written in pure Haskell and is capable of logging to a local or remote machine using the Syslog protocol.

You can create a new Syslog LogHandler by calling openlog.

More information on the Haskell Logging Framework can be found at System.Log.Logger. This module can also be used outside of the rest of that framework for those interested in that.

Synopsis

Handler Initialization

openlog Source

Arguments

:: String

The name of this program -- will be prepended to every log message

-> [Option]

A list of Options. The list [] is perfectly valid. [PID] is probably most common here.

-> Facility

The Facility value to pass to the syslog system for every message logged

-> Priority

Messages logged below this priority will be ignored. To include every message, set this to DEBUG.

-> IO SyslogHandler

Returns the new handler

Initialize the Syslog system using the local system's default interface, /dev/log. Will return a new LogHandler.

On Windows, instead of using /dev/log, this will attempt to send UDP messages to something listening on the syslog port (514) on localhost.

Use openlog_remote if you need more control.

Advanced handler initialization

openlog_local Source

Arguments

:: String

Path to FIFO

-> String

Program name

-> [Option]

Options

-> Facility

Facility value

-> Priority

Priority limit

-> IO SyslogHandler 

Initialize the Syslog system using an arbitrary Unix socket (FIFO).

Not supported under Windows.

openlog_remote Source

Arguments

:: Family

Usually AF_INET or AF_INET6; see Network.Socket

-> HostName

Remote hostname. Some use localhost

-> PortNumber

514 is the default for syslog

-> String

Program name

-> [Option]

Options

-> Facility

Facility value

-> Priority

Priority limit

-> IO SyslogHandler 

Log to a remote server via UDP.

openlog_generic Source

Arguments

:: Socket

A datagram socket

-> SockAddr

Address for transmissions

-> SocketType

socket connection mode (stream / datagram)

-> String

Program name

-> [Option]

Options

-> Facility

Facility value

-> Priority

Priority limit

-> IO SyslogHandler 

The most powerful initialization mechanism. Takes an open datagram socket.

Data Types

data Facility Source

Facilities are used by the system to determine where messages are sent.

Constructors

KERN

Kernel messages; you should likely never use this in your programs

USER

General userland messages. Use this if nothing else is appropriate

MAIL

E-Mail system

DAEMON

Daemon (server process) messages

AUTH

Authentication or security messages

SYSLOG

Internal syslog messages; you should likely never use this in your programs

LPR

Printer messages

NEWS

Usenet news

UUCP

UUCP messages

CRON

Cron messages

AUTHPRIV

Private authentication messages

FTP

FTP messages

LOCAL0

LOCAL0 through LOCAL7 are reserved for you to customize as you wish

LOCAL1 
LOCAL2 
LOCAL3 
LOCAL4 
LOCAL5 
LOCAL6 
LOCAL7 

data Option Source

Options for openlog.

Constructors

PID

Automatically log process ID (PID) with each message

PERROR

Send a copy of each message to stderr