monad-logger-extras-0.1.1.1: Utilities for composing loggers, coloring output, plus a few orphan instances.

Safe HaskellNone
LanguageHaskell2010

Control.Monad.Logger.Extras

Description

 
Synopsis

Documentation

runLoggerLoggingT :: LoggingT m a -> Logger -> m a Source #

Run a LoggingT action using the provided Logger

type LogF = Loc -> LogSource -> LogLevel -> LogStr -> IO () Source #

Type synonym for a logging action. See defaultLogStr for the default formatting of this data.

newtype Logger Source #

A composable logging action.

Constructors

Logger 

Fields

Instances
Semigroup Logger Source # 
Instance details

Defined in Control.Monad.Logger.Extras

Monoid Logger Source # 
Instance details

Defined in Control.Monad.Logger.Extras

logToStderr :: Logger Source #

Composable stderr logging action.

logToStdout :: Logger Source #

Composable stdout logging action.

logToNowhere :: Logger Source #

This logger doesn't perform any logging action.

logToSyslog :: String -> Logger Source #

Log messages to a posix system log. The string argument is a tag that can be used to identify log messages produced by this logger. You can, for instance, run journalctl --user -t mytag to see log messages tagged with "mytag".

colorize :: Logger -> Logger Source #

Add colors to your log output based on LogLevel. Colors can be customized by using colorizeWith instead.

colorizeWith :: [(LogLevel, Color)] -> Logger -> Logger Source #

Add a custom set of colors to your log output. See defaultColors for an example.

defaultColors :: [(LogLevel, Color)] Source #

The default color mapping used by colorize.

mapLogStrBS :: ToLogStr msg => (ByteString -> msg) -> LogStr -> LogStr Source #

Map a function over a log string.

wrapSGRCode :: [SGR] -> ByteString -> ByteString Source #

Apply SGR codes to a string to modify its display attributes, resetting SGR codes afterward.

wrapSGRColor :: Color -> ByteString -> ByteString Source #

Apply an SGR color code to a string, unsetting the color after the string.

test :: IO () Source #

A handy test