std/log

Standard Library documentation

Structured logging helpers for scripts.

Module

Name
std/log
Area
Standard Library
Source
modules/std/log.zzm

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

  • Log

    Static methods:

    • configure(options)

      Parameters: options is a dictionary with optional level, timestamps, and stderr_for_errors fields. Returns: null. Configures global logging behaviour.

    • level()

      Parameters: none. Returns: String. Returns the current level name.

    • debug(...), info(...), warn(...), error(...)

      Parameters: parts are values to concatenate into the message. Returns: null. Writes one log line when the message level is enabled.

    • log(level, ...)

      Parameters: level is a level name and parts are 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.