NAME
std/log - Structured logging helpers for scripts.
SYNOPSIS
from std/log import Log;
Log.configure( {
level: "info",
timestamps: 1,
stderr_for_errors: 1,
} );
Log.info( "started" );
Log.warn( "missing value for ", "foo" );
IMPLEMENTATION SUPPORT
This module is supported by all implementations of ZuzuScript.
DESCRIPTION
This module provides lightweight structured logging with level filtering, optional timestamps, and stderr routing for warnings and errors.
EXPORTS
Classes
LogStatic methods:
configure(options)Parameters:
optionsis a dictionary with optionallevel,timestamps, andstderr_for_errorsfields. Returns:null. Configures global logging behaviour.level()Parameters: none. Returns:
String. Returns the current level name.debug(...),info(...),warn(...),error(...)Parameters:
partsare values to concatenate into the message. Returns:null. Writes one log line when the message level is enabled.log(level, ...)Parameters:
levelis a level name andpartsare message values. Returns:null. Writes one log line at the requested dynamic level.
COPYRIGHT AND LICENCE
std/log is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.