fast-logger-3.2.8: A fast logging system
Safe HaskellNone
LanguageHaskell2010

System.Log.FastLogger.File

Synopsis

Documentation

data FileLogSpec Source #

The spec for logging files

Constructors

FileLogSpec 

Fields

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

check :: FilePath -> IO () Source #

Checking if a log file can be written.

rotate :: FileLogSpec -> IO () Source #

Rotating log files.

The log file is renamed while it is still open, which every platform allows except Windows, and Windows allows it only of a file opened sharing deletion. The descriptor FD opens is not, so under the POSIX subsystem there -- +RTS --io-manager=posix, which is still the default -- this is refused and the file does not rotate. Under the native one the file is a Handle, which is shared for deletion, and it does.

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

Prefix file name with formatted time