Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging modules: fixes and unification #8

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/src/Commence/Multilogging.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ module Commence.Multilogging
-- * Flush and close the loggers, eg. at the end of an application lifecycle.
, flushAndCloseLoggers

-- * Run a LogT over all loggers.
, runAppNameLoggers

-- * Typeclass for monads that support logging over multiple loggers.
, MonadAppNameLogMulti(..)

Expand Down Expand Up @@ -138,6 +141,10 @@ newtype AppNameLoggers = AppNameLoggers { _appNameLoggers :: [L.AppNameLogger]

makeLenses ''AppNameLoggers

-- | Evaluate a given `ML.LogT` operation over all the loggers.
runAppNameLoggers :: forall m a . (MonadIO m, MonadMask m) => AppNameLoggers -> ML.LogT L.AppName m a -> m ()
runAppNameLoggers (AppNameLoggers loggers) msg = mapM_ (`ML.runLogTSafe` msg) loggers

-- | Generate loggers with a given configuration: generates separate loggers for each LogType specified in the config.
makeDefaultLoggersWithConf :: MonadIO m => LoggingConf -> m AppNameLoggers
makeDefaultLoggersWithConf LoggingConf {..} =
Expand Down