co-log-0.2.0: Composable Contravariant Comonadic Logging Library

Colog.Rotation

Description

This functionality is not to be considered stable or ready for production use. While we enourage you to try it out and report bugs, we cannot assure you that everything will work as advertised :)

Synopsis

# Documentation

data Limit Source #

Constructors

 LimitTo Natural Unlimited
Instances
 Source # Instance detailsDefined in Colog.Rotation Methods(==) :: Limit -> Limit -> Bool #(/=) :: Limit -> Limit -> Bool # Source # Instance detailsDefined in Colog.Rotation Methods(<) :: Limit -> Limit -> Bool #(<=) :: Limit -> Limit -> Bool #(>) :: Limit -> Limit -> Bool #(>=) :: Limit -> Limit -> Bool #max :: Limit -> Limit -> Limit #min :: Limit -> Limit -> Limit #

Arguments

 :: MonadIO m => Limit Max allowed file size in bytes -> Limit Max allowed number of files to have -> FilePath File path to log -> (FilePath -> IO ()) What to do with old files; pass removeFile here for deletion -> (Handle -> LogAction m msg) Action that writes to file handle -> (LogAction m msg -> IO r) Continuation action -> IO r

Logger rotation action. Takes name of the logging file file.foo. Always writes new logs to file named file.foo (given file name, also called as hot log).

• If the size of the file exceeds given limit for file sizes then this action renames file.foo to file.foo.(n + 1) (where n is the number of latest renamed file).
• If the number of files on the filesystem is bigger than the files number limit then the given FilePath -> IO () action is called on the oldest file. As simple solution, you can pass removeFile function to delete old files but you can also pass some archiving function if you don't want to lose old logs.