Idris2Doc : Log4Types.ANSI

Log4Types.ANSI

(source)
ANSI-coloured console output for log4types.

Severity-coloured bracketed tags and a coloured text renderer for
development-time console logging. Colour codes are emitted only when
stdout is a terminal; redirected output stays plain.

Reexports

importpublic Control.ANSI

Definitions

severityColor : Severity->Color
  Pick an ANSI colour for a severity level.

Debug is green, Info blue, Warning yellow, Error red - matching the
conventions used by most CLI tools.

Totality: total
Visibility: public export
fmtColouredSeverity : Severity->String
  Format a severity as a coloured bracketed tag.

The output is the same bracketed text as `fmtSeverity` (e.g. `[ERROR]`)
wrapped in ANSI escape sequences for the matching colour.

Totality: total
Visibility: public export
colouredTextRenderer : LogRendererString
  A LogRenderer that produces key=value text with a coloured severity tag
when the renderer encounters a "severity" field.

Non-severity fields render exactly as `textRenderer` does.

Totality: total
Visibility: public export
stdoutIsTTY : HasIOio=>ioBool
  True when stdout is connected to a terminal.

Used to decide whether ANSI colour codes should be emitted. When the
output is redirected to a file or pipe, colours are suppressed.

Totality: total
Visibility: export
fmtColouredMsg : Msg->String
  Render a Msg as a single line: coloured severity tag, message text,
and any structured fields as `key=value` pairs.

Totality: total
Visibility: public export
fmtMsgForTTY : Bool->Msg->String
  Pick a Msg formatter based on TTY availability.

When `True`, returns the coloured formatter `fmtColouredMsg`.
When `False`, falls back to plain `show` so redirected output stays clean.

Totality: total
Visibility: public export
colouredLogStdout : HasIOio=>io (LogActionioMsg)
  A log action that writes Msg values to stdout with ANSI colouring
when stdout is a terminal, and plain text otherwise.

Totality: total
Visibility: export