hslogger-1.3.2.0: 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 Source #

#### Instances

Instances details

LogHandler SyslogHandler Source # |

Instance details

Defined in System.Log.Handler.Syslog

Methods

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

openlog Source #

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 Source #

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 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] | `Option`s
-> 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] | `Option`s
-> 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 |

#### Instances

Instances details

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

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

#### Instances

Instances details

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