di-handle-1.0: IO support for file handles in di-core

Safe HaskellNone
LanguageHaskell2010

Di.Handle

Synopsis

Documentation

stderr Source #

Arguments

:: (MonadIO m, MonadIO n) 
=> LineRenderer level path msg

How to render each Log line.

-> m (Log level path msg -> n ()) 

Logs are written to stderr, one per line.

WARNING Currently this always renders as UTF-8.

handle Source #

Arguments

:: (MonadIO m, MonadIO n) 
=> Maybe Bool

Whether to render with colors.

If Nothing, then we'll render with ANSI colors when the given Handle is a TTY. You probably want to use Nothing here most of the time.

-> Handle

Handle where to write Logs.

-> LineRenderer level path msg

How to render each Log.

-> m (Log level path msg -> n ()) 

Like blob, but each Log is rendered as text in its own line.

If the given Handle is associated to a TTY supporting ANSI colors, and the given LineRenderer supports rendering with colors, and you ask for it, then you will get colorful output.

blob Source #

Arguments

:: (MonadIO m, MonadIO n) 
=> Handle

Handle where to write Logs.

-> BlobRenderer level path msg

How to render each Log.

-> m (Log level path msg -> n ()) 

Write Logs to a Handle as a binary blob.

data LineRenderer level path msg Source #

How to render a Log as a line of text.

Constructors

LineRendererUtf8 !(Bool -> Log level path msg -> Builder)

The returned bytes must not contain a leading nor trailing newline.

The Bool tells whether we are trying to write these bytes to a terminal that supports ANSI colors.

data BlobRenderer level path msg Source #

How to render a Log as a binary blob.

Constructors

BlobRenderer !(Log level path msg -> Builder)