magus v0.4.3 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 (29d8b3de)
Earlier changes on this page (6)

Full history ↗ · Blame source ↗

Glossary

Magusfile

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

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. Target in full.

Op

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

Module

A magus stdlib namespace a magusfile imports for host capabilities: filesystem, exec, vcs, and more. Module in full.

Buzz

The language magusfiles are written in (the .buzz engine). Buzz in full.

Trace

OpenTelemetry's name for one whole magus invocation; every target it runs is a span beneath it. Trace in full.

Run

One target executing under one magus invocation, such as magus run test web or magus affected ci. A run keeps its captured output behind an output reference. Every magus run is a run whether or not any job asked for it; see Job for how the two relate. Run in full.

Conventions

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