Copyright | Copyright (C) 2004-2011 John Goerzen |
---|---|
License | BSD3 |
Maintainer | John Goerzen <jgoerzen@complete.org> |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
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
- data SyslogHandler
- 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 -> SocketType -> String -> [Option] -> Facility -> Priority -> IO SyslogHandler
- data Facility
- data Option
Documentation
data SyslogHandler Source #
Instances
LogHandler SyslogHandler Source # | |
Defined in System.Log.Handler.Syslog setLevel :: SyslogHandler -> Priority -> SyslogHandler Source # getLevel :: SyslogHandler -> Priority Source # setFormatter :: SyslogHandler -> LogFormatter SyslogHandler -> SyslogHandler Source # getFormatter :: SyslogHandler -> LogFormatter SyslogHandler Source # handle :: SyslogHandler -> LogRecord -> String -> IO () Source # emit :: SyslogHandler -> LogRecord -> String -> IO () Source # close :: SyslogHandler -> IO () Source # |
Handler Initialization
:: String | The name of this program -- will be prepended to every log message |
-> [Option] | A list of |
-> Facility | The |
-> Priority | Messages logged below this priority will be ignored. To include every message, set this to |
-> 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
:: String | Path to FIFO |
-> String | Program name |
-> [Option] | |
-> Facility | Facility value |
-> Priority | Priority limit |
-> IO SyslogHandler |
Initialize the Syslog system using an arbitrary Unix socket (FIFO).
Not supported under Windows.
:: Family | Usually AF_INET or AF_INET6; see Network.Socket |
-> HostName | Remote hostname. Some use |
-> PortNumber | 514 is the default for syslog |
-> String | Program name |
-> [Option] | |
-> Facility | Facility value |
-> Priority | Priority limit |
-> IO SyslogHandler |
Log to a remote server via UDP.
:: Socket | A datagram socket |
-> SockAddr | Address for transmissions |
-> SocketType | socket connection mode (stream / datagram) |
-> String | Program name |
-> [Option] | |
-> Facility | Facility value |
-> Priority | Priority limit |
-> IO SyslogHandler |
The most powerful initialization mechanism. Takes an open datagram socket.
Data Types
Facilities are used by the system to determine where messages are sent.
KERN | Kernel messages; you should likely never use this in your programs |
USER | General userland messages. Use this if nothing else is appropriate |
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 |