X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn.git;a=blobdiff_plain;f=src%2FLogging.hs;h=ede739a28ba9a9027bbbebc894dc51a5ad0cdd18;hp=8e80ac96414e7f5ad8bfc9d6cdd278bfde641acd;hb=ac3a81eb6d0f8ca4e212752d5b390a4fc220cceb;hpb=f6cb0ba712e06e52d080b86e9eba6c3585a7514b diff --git a/src/Logging.hs b/src/Logging.hs index 8e80ac9..ede739a 100644 --- a/src/Logging.hs +++ b/src/Logging.hs @@ -26,20 +26,30 @@ import System.Log.Logger ( warningM ) +-- | Log a message at the DEBUG level. log_debug :: String -> IO () log_debug = debugM rootLoggerName +-- | Log a message at the ERROR level. log_error :: String -> IO () log_error = errorM rootLoggerName +-- | Log a message at the INFO level. log_info :: String -> IO () log_info = infoM rootLoggerName +-- | Log a message at the WARNING level. log_warning :: String -> IO () log_warning = warningM rootLoggerName --- | Why don't we take a Configuration as an argument? Because it +-- | Set up the logging. All logs are handled by the global "root" +-- logger provided by HSLogger. We remove all of its handlers so +-- that it does nothing; then we conditionally add back two handlers +-- -- one for syslog, and one for a normal file -- dependent upon +-- the 'syslog' and 'log_file' configuration items. +-- +-- Why don't we take a Configuration as an argument? Because it -- would create circular imports! init_logging :: Maybe FilePath -> Priority -> Bool -> IO () init_logging log_file log_level syslog = do