System.Log.Handler.Syslog

hslogger-1.3.1.1: Versatile logging framework

Copyright | Copyright (C) 2004-2011 John Goerzen
License | BSD3
Portability | portable
Safe Haskell | None
Language | Haskell2010

System.Log.Handler.Syslog

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

- 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
  - = KERN
  - | USER
  - | MAIL
  - | DAEMON
  - | AUTH
  - | SYSLOG
  - | LPR
  - | NEWS
  - | UUCP
  - | CRON
  - | AUTHPRIV
  - | FTP
  - | LOCAL0
  - | LOCAL1
  - | LOCAL2
  - | LOCAL3
  - | LOCAL4
  - | LOCAL5
  - | LOCAL6
  - | LOCAL7
- data Option
  - = PID
  - | PERROR

# Documentation

data SyslogHandler #

#### Instances

Instances details

LogHandler SyslogHandler # |
Instance details Defined in System.Log.Handler.Syslog Methods setLevel :: SyslogHandler -> Priority -> SyslogHandler # getLevel :: SyslogHandler -> Priority # setFormatter :: SyslogHandler -> LogFormatter SyslogHandler -> SyslogHandler # getFormatter :: SyslogHandler -> LogFormatter SyslogHandler # handle :: SyslogHandler -> LogRecord -> String -> IO () # emit :: SyslogHandler -> LogRecord -> String -> IO () # close :: SyslogHandler -> IO () #

# Handler Initialization

openlog #

Arguments

:: String | The name of this program -- will be prepended to every log message
-> [Option] | A list of `Option`s. 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 #

Arguments

:: String | Path to FIFO
-> String | Program name
-> [Option] | `Option`s
-> Facility | Facility value
-> Priority | Priority limit
-> IO SyslogHandler |

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

Not supported under Windows.

openlog_remote #

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] | `Option`s
-> Facility | Facility value
-> Priority | Priority limit
-> IO SyslogHandler |

Log to a remote server via UDP.

openlog_generic #

Arguments

:: Socket | A datagram socket
-> SockAddr | Address for transmissions
-> SocketType | socket connection mode (stream / datagram)
-> String | Program name
-> [Option] | `Option`s
-> Facility | Facility value
-> Priority | Priority limit
-> IO SyslogHandler |

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

# Data Types

data Facility #

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 |

#### Instances

Instances details

Read Facility # |
Instance details Defined in System.Log.Handler.Syslog Methods readsPrec :: Int -> ReadS Facility # readList :: ReadS [Facility] # readPrec :: ReadPrec Facility # readListPrec :: ReadPrec [Facility] #
Show Facility # |
Instance details Defined in System.Log.Handler.Syslog Methods showsPrec :: Int -> Facility -> ShowS # show :: Facility -> String # showList :: [Facility] -> ShowS #
Eq Facility # |
Instance details Defined in System.Log.Handler.Syslog Methods (==) :: Facility -> Facility -> Bool # (/=) :: Facility -> Facility -> Bool #

data Option #

Options for `openlog`.

Constructors

PID | Automatically log process ID (PID) with each message
PERROR | Send a copy of each message to stderr

#### Instances

Instances details

Read Option # |
Instance details Defined in System.Log.Handler.Syslog Methods readsPrec :: Int -> ReadS Option # readList :: ReadS [Option] # readPrec :: ReadPrec Option # readListPrec :: ReadPrec [Option] #
Show Option # |
Instance details Defined in System.Log.Handler.Syslog Methods showsPrec :: Int -> Option -> ShowS # show :: Option -> String # showList :: [Option] -> ShowS #
Eq Option # |
Instance details Defined in System.Log.Handler.Syslog Methods (==) :: Option -> Option -> Bool # (/=) :: Option -> Option -> Bool #