fast-logger-0.3.1: A fast logging system

Safe HaskellSafe-Infered

System.Log.FastLogger

Contents

Description

Fast logging system to copy log data directly to Handle buffer.

Synopsis

Logger

data Logger Source

Abstract data type for logger.

mkLoggerSource

Arguments

:: Bool

Automatically flush on each loggerPut?

-> Handle

If Handle is associated with a file, AppendMode must be used.

-> IO Logger 

Creates a Logger from the given handle. (ondemandDateCacher zonedDateCacheConf) is used as a Date getter.

mkLogger2Source

Arguments

:: Bool

Automatically flush on each loggerPut?

-> Handle

If Handle is associated with a file, AppendMode must be used.

-> (DateCacheGetter, DateCacheCloser)

Date getter/closer. E.g. (clockDateCacher zonedDateCacheConf)

-> IO Logger 

Creates a Logger from the given handle.

renewLogger :: Logger -> Handle -> IO LoggerSource

Creates a new Logger from old one by replacing Handle. The new Handle automatically inherits the file mode of the old one. The old Handle is automatically closed.

rmLogger :: Logger -> IO ()Source

Destroy a Logger by closing internal Handle.

Logging

loggerPutStr :: Logger -> [LogStr] -> IO ()Source

The hPut function to copy a list of LogStr to the buffer of Handle of Logger directly.

loggerPutBuilder :: Logger -> Builder -> IO ()Source

The hPut function directory to copy Builder to the buffer. The current implementation is inefficient at this moment. This would replace loggerPutStr someday.

loggerFlush :: Logger -> IO ()Source

Flushing the buffer of Handle of Logger.

Strings

data LogStr Source

A date type to contain String and ByteString. This data is exported so that format can be defined. This would be replaced with Builder someday when it can be written directly to Handle buffer.

Constructors

LS !String 
LB !ByteString 

Date

loggerDate :: Logger -> IO ZonedDateSource

Obtaining date string from Logger.

File rotation