| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Shrun.Logging.MonadRegionLogger
Description
Provides functionality for logging to a specific region (i.e. for concurrent console logging).
Synopsis
- class (Eq (Region m), Monad m) => MonadRegionLogger (m :: Type -> Type) where
- type Region (m :: Type -> Type)
- logGlobal :: Text -> m ()
- logRegion :: LogMode -> Region m -> Text -> m ()
- withRegion :: HasCallStack => RegionLayout -> (Region m -> m a) -> m a
- displayRegions :: HasCallStack => m a -> m a
- regionList :: m (TMVar [Region m])
- restoreTimerRegion :: (MonadAtomic m, MonadIORef m, MonadRegionLogger m) => IORef (Maybe (Region m)) -> m ()
Documentation
class (Eq (Region m), 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.
regionList :: m (TMVar [Region m]) Source #
Retrieve all regions.
Instances
restoreTimerRegion :: (MonadAtomic m, MonadIORef m, MonadRegionLogger m) => IORef (Maybe (Region m)) -> m () Source #
Moves the timer region to the bottom of all active regions.
See NOTE: [Restore Timer Region].