FastLogger simply log logStr.
Modulefast-logger-3.2.6Haskell2010
System.Log.FastLogger
This module provides a fast logging system which scales on multicore environments (i.e. +RTS -N<x>).
Note: This library does not guarantee correct ordering of log messages when program is run on more than one core thus users should rely more on message timestamps than on their order in the log.
- 6 types
- 1 class
- 8 values
- Packagefast-logger-3.2.6
- Exports15
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceFastLogger.hs
FastLogger
6 declarationsLogger Type.
Constructors
LogNone :: LogType' LogStrLogStdout :: BufSize -> LogType' LogStrLogStderr :: BufSize -> LogType' LogStrLogFileNoRotate :: FilePath -> BufSize -> LogType' LogStrLogFile :: FileLogSpec -> BufSize -> LogType' LogStrLogFileTimedRotate :: TimedFileLogSpec -> BufSize -> LogType' LogStrLogCallback :: (a -> IO ()) -> IO () -> LogType' a
Initialize a FastLogger without attaching timestamp a tuple of logger and clean up action are returned. This type signature should be read as:
newFastLogger :: LogType -> IO (FastLogger, IO ())This logger uses numCapabilities many buffers, and thus
does not provide time-ordered output.
For time-ordered output, use newFastLogger1.
Like newFastLogger, but creating a logger that uses only 1 internal builder. This scales less on multi-core machines and consumes more memory because of an internal queue but provides time-ordered output.
bracket version of newFastLogger
Timed FastLogger
3 declarationsTimedFastLogger pass FormattedTime to callback and simply log its result. this can be used to customize how to log timestamp.
Usually, one would write a wrapper on top of TimedFastLogger, for example:
{-# LANGUAGE OverloadedStrings #-}
log :: TimedFastLogger -> LogStr -> IO ()
log logger msg = logger (\time -> toLogStr (show time) <> " " <> msg <> "\n")newTimedFastLogger :: IO FormattedTimeHow do we get FormattedTime? System.Log.FastLogger.Date provide cached formatted time.
-> LogType-> IO (TimedFastLogger, IO ())
Initialize a FastLogger with timestamp attached to each message. a tuple of logger and clean up action are returned.
bracket version of newTimeFastLogger
Log messages
4 declarationsLog message builder. Use (<>) to append two LogStr in O(1).
Instances6Eq, Show, IsString, Semigroup, Monoid, ToLogStr
Eq LogStrDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrShow LogStrDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrIsString LogStrDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrSemigroup LogStrDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrMonoid LogStrDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr LogStrDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStr
Types that can be converted to a LogStr. Instances for
types from the text library use a UTF-8 encoding. Instances
for numerical types use a decimal encoding.
Instances21ToLogStr, …
ToLogStr BuilderDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr ByteStringDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr ByteStringDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr ShortByteStringDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr LogStrDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr IntegerDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr StringDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr Int16Defined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr Int32Defined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr Int64Defined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr Int8Defined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr Word16Defined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr Word32Defined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr Word64Defined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr Word8Defined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr DoubleDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr FloatDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr IntDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr WordDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr TextDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStrToLogStr TextDefined in fast-logger-3.2.6 · System.Log.FastLogger.LogStr
Converting LogStr to ByteString.
Obtaining the length of LogStr.
Buffer size
2 declarationsThe type for buffer size of each core.
The default buffer size (4,096 bytes).
LoggerSet
0 declarationsDate cache
0 declarationsmodule System.Log.FastLogger.Date
File rotation
0 declarationsmodule System.Log.FastLogger.File
Types
0 declarationsmodule System.Log.FastLogger.Types