Copyright | Copyright (C) 2004-2011 John Goerzen |
---|---|
License | BSD3 |
Maintainer | John Goerzen <jgoerzen@complete.org> |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Simple log handlers
Written by John Goerzen, jgoerzen@complete.org
- data GenericHandler a = GenericHandler {
- severity :: !Severity
- formatter :: !(LogFormatter (GenericHandler a))
- privData :: !a
- writeFunc :: !(a -> Text -> IO ())
- closeFunc :: !(a -> IO ())
- readBackBuffer :: !(MVar (MemoryQueue Text))
- ghTag :: !LogHandlerTag
- defaultHandleAction :: Handle -> Text -> IO ()
- fileHandler :: FilePath -> Severity -> IO (GenericHandler Handle)
- streamHandler :: Handle -> (Handle -> Text -> IO ()) -> MVar () -> Severity -> IO (GenericHandler Handle)
Documentation
data GenericHandler a Source #
A helper data type.
GenericHandler | |
|
Typeable * a => LogHandler (GenericHandler a) Source # | |
defaultHandleAction :: Handle -> Text -> IO () Source #
Default action which just prints to handle using given message.
Custom handlers
fileHandler :: FilePath -> Severity -> IO (GenericHandler Handle) Source #
Create a file log handler. Log messages sent to this handler
will be sent to the filename specified, which will be opened in
Append mode. Calling close
on the handler will close the file.
streamHandler :: Handle -> (Handle -> Text -> IO ()) -> MVar () -> Severity -> IO (GenericHandler Handle) Source #
Create a stream log handler. Log messages sent to this handler
will be sent to the stream used initially. Note that the close
method will have no effect on stream handlers; it does not actually
close the underlying stream.