aspartik.logger

class Level:

#

Log verbosity level

It's a reversed version of log's Level. The least important events have the lower value, so Trace < Error.

Trace

#

Debug

#

Info

#

Warn

#

Error

#

class Logger:

#

A builder for the Rust-native logger

It must be populated with it's methods and initialized with init.

def with_targets(self, /, targets)

#

Filters the events by their target

A logger internally has a list of targets. If it's empty, all events are logged. If it's not, an event's target must have a prefix from the logger target list, otherwise it won't be logged.

This call is additive. That is, calling with_targets twice will combine targets from both calls.

def to_file(self, /, path)

#

Sets the file path to which the logs will be written

The default path is b3.log, which will be created in the CWD.

def with_level(self, /, min_level)

#

Sets the logging level

Error by default.

def init(self, /)

#

Starts the logger

The options can be configured using with_targets, with_level, and to_file.