Safe Haskell | None |
---|---|
Language | Haskell98 |
System.Log.FastLogger
Contents
Description
This module provides a fast logging system which scales on multicore environments (i.e. +RTS -N<x>).
- data LoggerSet
- newFileLoggerSet :: BufSize -> FilePath -> IO LoggerSet
- newStdoutLoggerSet :: BufSize -> IO LoggerSet
- newStderrLoggerSet :: BufSize -> IO LoggerSet
- newLoggerSet :: BufSize -> Maybe FilePath -> IO LoggerSet
- type BufSize = Int
- defaultBufSize :: BufSize
- renewLoggerSet :: LoggerSet -> IO ()
- rmLoggerSet :: LoggerSet -> IO ()
- data LogStr
- class ToLogStr msg where
- fromLogStr :: LogStr -> ByteString
- logStrLength :: LogStr -> Int
- pushLogStr :: LoggerSet -> LogStr -> IO ()
- flushLogStr :: LoggerSet -> IO ()
- module System.Log.FastLogger.File
Creating a logger set
data LoggerSet
A set of loggers. The number of loggers is the capabilities of GHC RTS. You can specify it with "+RTS -N<x>". A buffer is prepared for each capability.
newStdoutLoggerSet :: BufSize -> IO LoggerSet
Creating a new LoggerSet
using stdout.
newStderrLoggerSet :: BufSize -> IO LoggerSet
Creating a new LoggerSet
using stderr.
Buffer size
The default buffer size (4,096 bytes).
Renewing and removing a logger set
renewLoggerSet :: LoggerSet -> IO ()
Renewing the internal file information in LoggerSet
.
This does nothing for stdout and stderr.
rmLoggerSet :: LoggerSet -> IO ()
Flushing the buffers, closing the internal file information and freeing the buffers.
Log messages
class ToLogStr msg where
fromLogStr :: LogStr -> ByteString
Converting LogStr
to ByteString
.
logStrLength :: LogStr -> Int
Obtaining the length of LogStr
.
Writing a log message
pushLogStr :: LoggerSet -> LogStr -> IO ()
Writing a log message to the corresponding buffer. If the buffer becomes full, the log messages in the buffer are written to its corresponding file, stdout, or stderr.
Flushing buffered log messages
flushLogStr :: LoggerSet -> IO ()
Flushing log messages in buffers. This function must be called explicitly when the program is being terminated.
File rotation
module System.Log.FastLogger.File