Skip to content

Commit

Permalink
Add strictness annotations to IHP Log Types
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Jun 11, 2024
1 parent 0a779b7 commit f3a4d46
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions IHP/Log/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ show = tshow
-- logging operations. Users can also access this though the 'LoggingProvider'
-- class in controller and model actions to perform logic based on the set log level.
data Logger = Logger {
write :: (FastLogger.FormattedTime -> LogStr) -> IO (),
level :: LogLevel,
formatter :: LogFormatter,
timeCache :: IO FastLogger.FormattedTime,
cleanup :: IO ()
write :: !((FastLogger.FormattedTime -> LogStr) -> IO ()),
level :: !LogLevel,
formatter :: !LogFormatter,
timeCache :: !(IO FastLogger.FormattedTime),
cleanup :: !(IO ())
}

data LogLevel
Expand Down Expand Up @@ -145,7 +145,7 @@ data RotateSettings
-- destination = File "Log/production.log" (SizeRotate (Bytes (4 * 1024 * 1024)) 7) defaultBufSize
-- }
-- @
| SizeRotate Bytes Int
| SizeRotate !Bytes !Int
-- | Log messages to a file rotated on a timed basis.
-- Expects a time format string as well as a function which compares two formatted time strings
-- which is used to determine if the file should be rotated.
Expand All @@ -168,19 +168,19 @@ data RotateSettings
-- defaultBufSize
-- }
-- @
| TimedRotate TimeFormat (FastLogger.FormattedTime -> FastLogger.FormattedTime -> Bool) (FilePath -> IO ())
| TimedRotate !TimeFormat (FastLogger.FormattedTime -> FastLogger.FormattedTime -> Bool) (FilePath -> IO ())

-- | Where logged messages will be delivered to.
data LogDestination
= None
-- | Log messages to standard output.
| Stdout BufSize
| Stdout !BufSize
-- | Log messages to standard error.
| Stderr BufSize
| Stderr !BufSize
-- | Log message to a file. Rotate the log file with the behavior given by 'RotateSettings'.
| File FilePath RotateSettings BufSize
| File !FilePath !RotateSettings !BufSize
-- | Send logged messages to a callback. Flush action called after every log.
| Callback (LogStr -> IO ()) (IO ())
| Callback !(LogStr -> IO ()) !(IO ())

data LoggerSettings = LoggerSettings {
level :: LogLevel,
Expand Down

0 comments on commit f3a4d46

Please sign in to comment.