fast-logger-0.3.1: A fast logging system

Safe HaskellNone

System.Log.FastLogger

Contents

Description

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

Synopsis

Logger

data Logger

Abstract data type for logger.

mkLogger

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.

mkLogger2

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 Logger

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 ()

Destroy a Logger by closing internal Handle.

Logging

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

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

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

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 ()

Flushing the buffer of Handle of Logger.

Strings

data LogStr

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 ZonedDate

Obtaining date string from Logger.

File rotation