NetfoxLogger

Inherits: RefCounted

Logger implementation for use with netfox

Description

NetfoxLoggers implement distinct log levels. These can be used to filter which messages are actually emitted. All messages are output using @GlobalScope.print(). Warnings and errors are also pushed to the debug panel, using @GlobalScope.push_warning() and @GlobalScope.push_error() respectively, if push_to_debugger is enabled.

Every logger has a name, and belongs to a module. Logging level can be overridden per module, using module_log_level.

Loggers also support tags. Tags can be used to provide extra pieces of information that are logged with each message. Some tags are provided by netfox. Additional tags can be added using register_tag().

Tutorials

Properties

Type Name Default
int log_level
Dictionary module_log_level
bool push_to_debugger true
String module
String name

Methods

Return Type Name
void register_tag(Callable tag, int priority) static
void free_tag(Callable tag) static
void trace(String text, Array values)
void debug(String text, Array values)
void info(String text, Array values)
void warning(String text, Array values)
void error(String text, Array values)

Constants

LOG_ALL = 0

Filter level to log every message


LOG_TRACE = 1

Trace logs, the most verbose level


LOG_DEBUG = 2

Debug logs


LOG_INFO = 3

Info logs


LOG_WARN = 4

Warnings


LOG_ERROR = 5

Errors


LOG_NONE = 6

Filter level to log no messages


DEFAULT_LOG_LEVEL = 2

Default log level to fall back on, if not configured


Property Descriptions

int log_level

Global logging level, used by all loggers


Dictionary module_log_level

Per-module logging level, used only by loggers belonging to the given module

This is a dictionary that associates module names ( strings ) to log levels ( int, e.g. LOG_DEBUG ).


bool push_to_debugger = true

Set to true to enable calling @GlobalScope.push_warning() and @GlobalScope.push_error()


String module

Logger module


String name

Logger name


Method Descriptions

void register_tag ( Callable tag, int priority ) static

Register a tag

Tags are callables that provide pieces of context, included in all log messges. The tag callable must return a string.


void free_tag ( Callable tag ) static

Free an already registered tag


void trace ( String text, Array values )

Log a trace message

Traces are the most verbose, usually used for drilling down into very niche bugs.


void debug ( String text, Array values )

Log a debug message

Debug messages are verbose, usually used to reconstruct and investigate bugs.


void info ( String text, Array values )

Log an info message

Info messages provide general notifications about application events.


void warning ( String text, Array values )

Log a warning message

This is also forwarded to @GlobalScope.push_warning(), if enabled with push_to_debugger. Warning messages usually indicate that something has gone wrong, but is recoverable.


void error ( String text, Array values )

Log an error message

This is also forwarded to @GlobalScope.push_error(), if enabled with push_to_debugger. Error messages usually indicate an issue that can't be recovered from.