fast-logger-3.2.6: A fast logging system

Safe Haskell | None
Language | Haskell2010

System.Log.FastLogger.File

Synopsis

- data FileLogSpec = FileLogSpec {
  - log_file :: FilePath
  - log_file_size :: Integer
  - log_backup_number :: Int
  }
- data TimedFileLogSpec = TimedFileLogSpec {
  - timed_log_file :: FilePath
  - timed_timefmt :: TimeFormat
  - timed_same_timeframe :: FormattedTime -> FormattedTime -> Bool
  - timed_post_process :: FilePath -> IO ()
  }
- check :: FilePath -> IO ()
- rotate :: FileLogSpec -> IO ()
- prefixTime :: FormattedTime -> FilePath -> FilePath

# Documentation

data FileLogSpec Source #

The spec for logging files

Constructors

FileLogSpec |

Fields

- log_file :: FilePath
- log_file_size :: Integer

  Max log file size (in bytes) before requiring rotation.

- log_backup_number :: Int

  Max number of rotated log files to keep around before overwriting the oldest one.

data TimedFileLogSpec Source #

The spec for time based rotation. It supports post processing of log files. Does not delete any logs. Example:

    timeRotate fname = LogFileTimedRotate
                   (TimedFileLogSpec fname timeFormat sametime compressFile)
                   defaultBufSize
       where
           timeFormat = "%FT%H%M%S"
           sametime = (==) on C8.takeWhile (/=T)
           compressFile fp = void . forkIO $
               callProcess "tar" [ "--remove-files", "-caf", fp <> ".gz", fp ]

Constructors

TimedFileLogSpec |

Fields

- timed_log_file :: FilePath

  base file path

- timed_timefmt :: TimeFormat

  time format to prepend

- timed_same_timeframe :: FormattedTime -> FormattedTime -> Bool

  function that compares two formatted times as specified by timed_timefmt and decides if a new rotation is supposed to begin

- timed_post_process :: FilePath -> IO ()

  processing function called asynchronously after a file is added to the rotation

check :: FilePath -> IO () Source #

Checking if a log file can be written.

rotate :: FileLogSpec -> IO () Source #

Rotating log files.

prefixTime :: FormattedTime -> FilePath -> FilePath Source #

Prefix file name with formatted time