magus v0.4.2 is out. See what's new
¶ View generated markdown
2 min read

log

Emit a message at a level through magus's own logger, so it honors -q/-v/-vv, renders in the run's format, is redacted, and is captured in the run log. Unlike std\print, which is an uncontrolled bare line.

Naming convention: import the module under its bare name (import "log"), reach members with a backslash, and call methods in camelCase: log\someMethod.

Methods

trace

Log at trace level (shown at -vvv). For detail worth having when reconstructing a run and noise at any other time.

Signature: log\trace(message, [attrs]) - source

Parameter Type Optional Description
message string
attrs map[string]any yes

debug

Log at debug level (shown at -v).

Signature: log\debug(message, [attrs]) - source

Parameter Type Optional Description
message string
attrs map[string]any yes

info

Log at info level (shown by default, hidden by -q).

Signature: log\info(message, [attrs]) - source

Parameter Type Optional Description
message string
attrs map[string]any yes

warn

Log at warn level: something the reader should act on eventually.

Signature: log\warn(message, [attrs]) - source

Parameter Type Optional Description
message string
attrs map[string]any yes

error

Log at error level. This RECORDS a problem; it does not fail the target - raise (or os\exit) is what ends a run.

Signature: log\error(message, [attrs]) - source

Parameter Type Optional Description
message string
attrs map[string]any yes

at

Log at a level chosen at runtime. Use it when the level is DATA rather than a literal - mapping a scanner's severity onto magus's levels, say - and the five named methods when it is not.

Signature: log\at(level, message, [attrs]) - source

Parameter Type Optional Description
level string
message string
attrs map[string]any yes
generatedreference/buzz/logmodulestdlibmagusfile
Last updated (4f8cc295)
Earlier changes on this page (3)

Full history ↗ · Blame source ↗

Glossary

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. See targets.

Target

A named operation (build, test, ...) you invoke with magus run <target>; it may compose a spell's tool-native operations and depend on other targets. See targets.

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). See operations.

Module

A magus stdlib namespace a magusfile imports for host capabilities: filesystem, exec, vcs, and more. See the module reference.

Buzz

The language magusfiles are written in (the .buzz engine). See engines.

Trace

OpenTelemetry's name for one whole magus invocation; every target it runs is a span beneath it. See telemetry.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.