TerminalLoggers.jl

TerminalLoggers.TerminalLoggersModule

TerminalLoggers

Stable Dev Build Status Codecov

TerminalLoggers provides a logger type TerminalLogger which can format your log messages in a richer way than the default ConsoleLogger which comes with the julia standard Logging library.

Read the documentation for more information.

TerminalLoggers.StickyMessagesType
StickyMessages(io::IO; ansi_codes=io isa Base.TTY && 
               (!Sys.iswindows() || VERSION >= v"1.5.3"))

A StickyMessages type manages the display of a set of persistent "sticky" messages in a terminal. That is, messages which are not part of the normal scrolling output. Each message is identified by a label and may may be added to the set using push!(messages, label=>msg), and removed using pop!(messages, label), or empty!().

Only a single StickyMessages object should be associated with a given TTY, as the object manipulates the terminal scrolling region.

TerminalLoggers.TerminalLoggerType
TerminalLogger(stream=stderr, min_level=LogLevel(-1); meta_formatter=default_metafmt,
               show_limited=true, right_justify=0)

Logger with formatting optimized for interactive readability in a text console (for example, the Julia REPL). This is an enhanced version of the terminal logger Logging.ConsoleLogger which comes installed with Julia by default.

Log levels less than min_level are filtered out.

Message formatting can be controlled by setting keyword arguments:

  • meta_formatter is a function which takes the log event metadata (level, _module, group, id, file, line) and returns a color (as would be passed to printstyled), prefix and suffix for the log message. The default is to prefix with the log level and a suffix containing the module, file and line location.
  • show_limited limits the printing of large data structures to something which can fit on the screen by setting the :limit IOContext key during formatting.
  • right_justify is the integer column which log metadata is right justified at. The default is zero (metadata goes on its own line).