hslogger-1.0.5: Versatile logging frameworkSource codeContentsIndex
System.Log.Handler.Syslog
Portabilityportable
Stabilityprovisional
MaintainerJohn Goerzen <jgoerzen@complete.org>
Contents
Handler Initialization
Advanced handler initialization
Data Types
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
openlog :: String -> [Option] -> Facility -> Priority -> IO SyslogHandler
openlog_local :: String -> String -> [Option] -> Facility -> Priority -> IO SyslogHandler
openlog_remote :: Family -> HostName -> PortNumber -> String -> [Option] -> Facility -> Priority -> IO SyslogHandler
openlog_generic :: Socket -> SockAddr -> String -> [Option] -> Facility -> Priority -> IO SyslogHandler
data Facility
= KERN
| USER
| MAIL
| DAEMON
| AUTH
| SYSLOG
| LPR
| NEWS
| UUCP
| CRON
| AUTHPRIV
| LOCAL0
| LOCAL1
| LOCAL2
| LOCAL3
| LOCAL4
| LOCAL5
| LOCAL6
| LOCAL7
data Option
= PID
| PERROR
Handler Initialization
openlogSource
:: StringThe 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.
-> FacilityThe Facility value to pass to the syslog system for every message logged
-> PriorityMessages logged below this priority will be ignored. To include every message, set this to DEBUG.
-> IO SyslogHandlerReturns 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_localSource
:: StringPath to FIFO
-> StringProgram name
-> [Option]Options
-> FacilityFacility value
-> PriorityPriority limit
-> IO SyslogHandler

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

Not supported under Windows.

openlog_remoteSource
:: FamilyUsually AF_INET or AF_INET6; see Network.Socket
-> HostNameRemote hostname. Some use localhost
-> PortNumber514 is the default for syslog
-> StringProgram name
-> [Option]Options
-> FacilityFacility value
-> PriorityPriority limit
-> IO SyslogHandler
Log to a remote server via UDP.
openlog_genericSource
:: SocketA datagram socket
-> SockAddrAddress for transmissions
-> StringProgram name
-> [Option]Options
-> FacilityFacility value
-> PriorityPriority 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
KERNKernel messages; you should likely never use this in your programs
USERGeneral userland messages. Use this if nothing else is appropriate
MAILE-Mail system
DAEMONDaemon (server process) messages
AUTHAuthentication or security messages
SYSLOGInternal syslog messages; you should likely never use this in your programs
LPRPrinter messages
NEWSUsenet news
UUCPUUCP messages
CRONCron messages
AUTHPRIVPrivate authentication messages
LOCAL0LOCAL0 through LOCAL7 are reserved for you to customize as you wish
LOCAL1
LOCAL2
LOCAL3
LOCAL4
LOCAL5
LOCAL6
LOCAL7
show/hide Instances
data Option Source
Options for openlog.
Constructors
PIDAutomatically log process ID (PID) with each message
PERRORSend a copy of each message to stderr
show/hide Instances
Produced by Haddock version 2.3.0