-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A fast logging system
--   
--   A fast logging system
@package fast-logger
@version 2.4.7

module System.Log.FastLogger.File

-- | The spec for logging files
data FileLogSpec
FileLogSpec :: FilePath -> Integer -> Int -> FileLogSpec
[log_file] :: FileLogSpec -> FilePath

-- | Max log file size (in bytes) before requiring rotation.
[log_file_size] :: FileLogSpec -> Integer

-- | Max number of rotated log files to keep around before overwriting the
--   oldest one.
[log_backup_number] :: FileLogSpec -> Int

-- | Checking if a log file can be written.
check :: FilePath -> IO ()

-- | Rotating log files.
rotate :: FileLogSpec -> IO ()


-- | Formatting time is slow. This package provides mechanisms to cache
--   formatted date.
module System.Log.FastLogger.Date
type TimeFormat = ByteString

-- | Type aliaes for date format and formatted date.
type FormattedTime = ByteString

-- | Make <a>IO</a> action which get cached formatted local time. Use this
--   to avoid the cost of frequently time formatting by caching an auto
--   updating formatted time, this cache update every 1 second. more detail
--   in <a>Control.AutoUpdate</a>
newTimeCache :: TimeFormat -> IO (IO FormattedTime)

-- | A simple time cache using format <tt>"%d<i>%b</i>%Y:%T %z"</tt>
simpleTimeFormat :: TimeFormat

-- | A simple time cache using format <tt>"%d-%b-%Y %T"</tt>
simpleTimeFormat' :: TimeFormat


-- | This module provides a fast logging system which scales on multicore
--   environments (i.e. +RTS -N&lt;x&gt;).
module System.Log.FastLogger

-- | A set of loggers. The number of loggers is the capabilities of GHC
--   RTS. You can specify it with "+RTS -N&lt;x&gt;". A buffer is prepared
--   for each capability.
data LoggerSet

-- | Creating a new <a>LoggerSet</a> using a file.
newFileLoggerSet :: BufSize -> FilePath -> IO LoggerSet

-- | Creating a new <a>LoggerSet</a> using stdout.
newStdoutLoggerSet :: BufSize -> IO LoggerSet

-- | Creating a new <a>LoggerSet</a> using stderr.
newStderrLoggerSet :: BufSize -> IO LoggerSet

-- | Creating a new <a>LoggerSet</a>. If <a>Nothing</a> is specified to the
--   second argument, stdout is used. Please note that the minimum
--   <a>BufSize</a> is 1.

-- | <i>Deprecated: Use newFileLoggerSet etc instead</i>
newLoggerSet :: BufSize -> Maybe FilePath -> IO LoggerSet

-- | The type for buffer size of each core.
type BufSize = Int

-- | The default buffer size (4,096 bytes).
defaultBufSize :: BufSize

-- | Renewing the internal file information in <a>LoggerSet</a>. This does
--   nothing for stdout and stderr.
renewLoggerSet :: LoggerSet -> IO ()

-- | Flushing the buffers, closing the internal file information and
--   freeing the buffers.
rmLoggerSet :: LoggerSet -> IO ()

-- | Log message builder. Use (<a>&lt;&gt;</a>) to append two LogStr in
--   O(1).
data LogStr
class ToLogStr msg
toLogStr :: ToLogStr msg => msg -> LogStr

-- | Converting <a>LogStr</a> to <a>ByteString</a>.
fromLogStr :: LogStr -> ByteString

-- | Obtaining the length of <a>LogStr</a>.
logStrLength :: LogStr -> Int

-- | 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.
pushLogStr :: LoggerSet -> LogStr -> IO ()

-- | Same as <a>pushLogStr</a> but also appends a newline.
pushLogStrLn :: LoggerSet -> LogStr -> IO ()

-- | Flushing log messages in buffers. This function must be called
--   explicitly when the program is being terminated.
--   
--   Note: Since version 2.1.6, this function does not need to be
--   explicitly called, as every push includes an auto-debounced flush
--   courtesy of the auto-update package. Since version 2.2.2, this
--   function can be used to force flushing outside of the debounced flush
--   calls.
flushLogStr :: LoggerSet -> IO ()

-- | <a>FastLogger</a> simply log <tt>logStr</tt>.
type FastLogger = LogStr -> IO ()

-- | <a>TimedFastLogger</a> pass <a>FormattedTime</a> to callback and
--   simply log its result. this can be used to customize how to log
--   timestamp.
type TimedFastLogger = (FormattedTime -> LogStr) -> IO ()

-- | Logger Type.
data LogType

-- | No logging.
LogNone :: LogType

-- | Logging to stdout. <a>BufSize</a> is a buffer size
LogStdout :: BufSize -> LogType

-- | Logging to stdout. <a>BufSize</a> is a buffer size for each
--   capability.
LogStderr :: BufSize -> LogType

-- | Logging to a file. <a>BufSize</a> is a buffer size for each
--   capability.
LogFileNoRotate :: FilePath -> BufSize -> LogType

-- | Logging to a file. <a>BufSize</a> is a buffer size for each
--   capability. File rotation is done on-demand.
LogFile :: FileLogSpec -> BufSize -> LogType

-- | Logging with a log and flush action. run flush after log each message.
LogCallback :: (LogStr -> IO ()) -> (IO ()) -> LogType

-- | Initialize a <a>FastLogger</a> without attaching timestamp a tuple of
--   logger and clean up action are returned.
newFastLogger :: LogType -> IO (FastLogger, IO ())

-- | <a>bracket</a> version of <a>newFastLogger</a>
withFastLogger :: LogType -> (FastLogger -> IO a) -> IO a

-- | Initialize a <a>FastLogger</a> with timestamp attached to each
--   message. a tuple of logger and clean up action are returned.
newTimedFastLogger :: IO FormattedTime -> LogType -> IO (TimedFastLogger, IO ())

-- | <a>bracket</a> version of <tt>newTimeFastLogger</tt>
withTimedFastLogger :: IO FormattedTime -> LogType -> (TimedFastLogger -> IO a) -> IO a
