| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
System.Log.FastLogger.File
Synopsis
- data FileLogSpec = FileLogSpec {}
- 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
| |
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
| |
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