Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module provides a simple logging functionality for recording
messages with different log levels (Error and Info). It uses
the FastLogger library to log messages with timestamps to the
standard output. The logging system captures UTCTime
to ensure
accurate time-stamped logs. The log
function can handle both
Left
and Right
values, logging them accordingly based on their
presence in the context of errors or informational messages.
Documentation
log :: (Show a, Show b) => Either a b -> IO () #
Logs a message based on the value of an Either
type.
The log
function accepts an 'Either a b' value where:
- If it is
Left
, it logs an error message with theError
log level. - If it is
Right
, it logs an informational message with theInfo
log level.
Each log entry is timestamped using the current UTC time, and messages are printed to standard output. The logger is flushed after logging to ensure all messages are displayed promptly.