module System.Logging.Facade (
log
, trace
, debug
, info
, warn
, error
, Logging
, LogLevel(..)
) where
import Prelude hiding (log, error)
import Data.CallStack
import System.Logging.Facade.Types
import System.Logging.Facade.Class
log :: (HasCallStack, Logging m) => LogLevel -> String -> m ()
log level message = consumeLogRecord (LogRecord level location message)
location :: HasCallStack => Maybe Location
location = case reverse callStack of
(_, loc) : _ -> Just $ Location (srcLocPackage loc) (srcLocModule loc) (srcLocFile loc) (srcLocStartLine loc) (srcLocStartCol loc)
_ -> Nothing
trace :: (HasCallStack, Logging m) => String -> m ()
trace = log TRACE
debug :: (HasCallStack, Logging m) => String -> m ()
debug = log DEBUG
info :: (HasCallStack, Logging m) => String -> m ()
info = log INFO
warn :: (HasCallStack, Logging m) => String -> m ()
warn = log WARN
error :: (HasCallStack, Logging m) => String -> m ()
error = log ERROR