LogLevel

DO NOT USE THIS YET IT IS NOT FUNCTIONAL NOR STABLE

More...

Values

ValueMeaning
trace
info
warn
error

Detailed Description

The arsd.core logger works differently than many in that it works as a ring buffer of objects that are consumed (or missed; buffer overruns are possible) by a different thread instead of strings written to some file.

A library (or an application) defines a log source. They write to this source.

Applications then define log listeners, zero or more, which reads from various sources and does something with them.

Log calls, in this sense, are quite similar to asynchronous events that can be subscribed to by event handlers. The difference is events are generally not dropped - they might coalesce but are usually not just plain dropped in a buffer overrun - whereas logs can be. If the log consumer can't keep up, the details are just lost. The log producer will not wait for the consumer to catch up.

An application can also set a default subscriber which applies to all log objects throughout.

All log message objects must be capable of being converted to strings and to json.

Ad-hoc messages can be done with interpolated sequences.

Messages automatically get a timestamp. They can also have file/line and maybe even a call stack.

Examples

auto logger = new shared LoggerOf!GenericEmbeddableInterpolatedSequence;

mylogger.info(i"$this heartbeat");

Meta

History

Added May 27, 2024

Not actually implemented until February 6, 2025, when it changed from mixin template to class.