Timber v0.2.3 Timber.Transports.IODevice
The IODevice transport mechanism allows you to log directly to
stdout
(default; see below) or any other IODevice of your choice
Default Output
The suggestion above is that the default configuration of this
transport will log to stdout
by default. This is true in most
cases, but it is misleadingly generic. The output will actually be
sent to the process registered under the name :user
. This process
is registered by the VM at startup and is designed to handle IO
redirection. In other words, :user
is the middleman that will
typically write to stdout
unless you have additional configuration
that would make it redirect output elsewhere.
Synchronicity
The IODevice transport will output messages asynchronously to the IO device using standard BEAM process messaging. After sending output to be written, the transport will begin buffering all new log events. When the remote IO device responds that the output was successful, the buffer will be flushed to the IO device, repeating the process. If the buffer reaches its maximum size, the transport will switch to simulated synchronous mode, blocking until the IO device sends a response about the last write operation.
Transport Configuration Options
The following options are available when configuring the IODevice logger:
colorize
When true
, the log level will be printed in a corresponding color using
ANSI console control characters to help identify it.
When false
, the log level will be printed out as standard text.
Defaults to true
.
hide_context
When true
, the contextual information that is used by Timber will be hidden
on the log lines using ANSI console control characters.
When false
, the contextual information will be printed out as standard
text.
Defaults to true
.
max_buffer_size
The maximum number of log entries that the log event buffer will hold until the transport switchs to synchronous mode. This value should be tuned to accomodate your system’s IO capability versus the amount of logging you perform.
Defaults to 100
.
print_log_level
When true
, the log level is printed in brackets as part of your log message.
When false
, the log level is not printed.
Regardless of the setting used, the log level will be recorded as part of Timber’s
metadata. Setting this to false
is recommended for production usage if you only
use Timber for viewing logs.
Defaults to false
.
print_timestamps
When true
, the timestamp for the log will be output at the front
of the statement.
When false
, the timestamp will be suppressed. This is only useful in situations
where the log will be written to an evented IO service that automatically adds
timestamps for incoming data, like Heroku Logplex.
Regardless of the setting used, the timestamp will be recorded as part of Timber’s
metadata. Setting this to false
is recommended for production usage if you only
use Timber for viewing logs.
Defaults to false
.