Blammo-1.1.2.2: Batteries-included Structured Logging library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Blammo.Logging.Colors

Description

Generic facilities for adding terminal escapes to Text

Recommended usage:

Colors {..} <- getColorsLogger -- for example
pure $ "This text will be " <> red "red" <> "."
Synopsis

Documentation

data Colors Source #

Constructors

Colors 

Fields

getColorsLogger :: (MonadReader env m, HasLogger env) => m Colors Source #

Return Colors consistent with whatever your logging is doing

getColorsHandle :: (MonadIO m, MonadReader env m, HasLogger env) => Handle -> m Colors Source #

Return Colors consistent with logging, but for Handle

This is useful if you are building text to print to a handle that is not the one you are logging to.

For example, say you are using,

LOG_COLOR=auto
LOG_DESTINATION=@some-file.log

That will not log with color, so getColorsLogger will be noColor. If you're building other text to be printed out, you probably want to respect that LOG_COLOR=auto, so you would use this function instead.