shrun-0.9: A utility program for running shell commands concurrently.
Safe HaskellNone
LanguageGHC2021

Shrun.Logging.MonadRegionLogger

Description

Provides functionality for logging to a specific region (i.e. for concurrent console logging).

Synopsis

Documentation

class Monad m => MonadRegionLogger (m :: Type -> Type) where Source #

MonadRegionLogger is a simple typeclass for abstracting logging functions.

Associated Types

type Region (m :: Type -> Type) Source #

The type of the region. This will be ConsoleRegion for production code and () for tests.

Methods

logGlobal :: Text -> m () Source #

Pushes a log to the "global" region.

logRegion :: LogMode -> Region m -> Text -> m () Source #

Pushes a log to the region.

withRegion :: HasCallStack => RegionLayout -> (Region m -> m a) -> m a Source #

Runs an m a with a region.

displayRegions :: HasCallStack => m a -> m a Source #

Displays the regions. This should wrap whatever top-level logic needs regions.

Instances

Instances details
MonadRegionLogger IO Source # 
Instance details

Defined in Shrun.Logging.MonadRegionLogger

Associated Types

type Region IO 
Instance details

Defined in Shrun.Logging.MonadRegionLogger

MonadRegionLogger m => MonadRegionLogger (ShellT (Env r) m) Source # 
Instance details

Defined in Shrun.ShellT

Associated Types

type Region (ShellT (Env r) m) 
Instance details

Defined in Shrun.ShellT

type Region (ShellT (Env r) m) = Region (ReaderT (Env r) m)

Methods

logGlobal :: Text -> ShellT (Env r) m () Source #

logRegion :: LogMode -> Region (ShellT (Env r) m) -> Text -> ShellT (Env r) m () Source #

withRegion :: HasCallStack => RegionLayout -> (Region (ShellT (Env r) m) -> ShellT (Env r) m a) -> ShellT (Env r) m a Source #

displayRegions :: HasCallStack => ShellT (Env r) m a -> ShellT (Env r) m a Source #

MonadRegionLogger m => MonadRegionLogger (ReaderT env m) Source # 
Instance details

Defined in Shrun.Logging.MonadRegionLogger

Associated Types

type Region (ReaderT env m) 
Instance details

Defined in Shrun.Logging.MonadRegionLogger

type Region (ReaderT env m) = Region m

Methods

logGlobal :: Text -> ReaderT env m () Source #

logRegion :: LogMode -> Region (ReaderT env m) -> Text -> ReaderT env m () Source #

withRegion :: HasCallStack => RegionLayout -> (Region (ReaderT env m) -> ReaderT env m a) -> ReaderT env m a Source #

displayRegions :: HasCallStack => ReaderT env m a -> ReaderT env m a Source #