stnd.build · DocumentationSTANDARD MANUALSTD-STND-LOG · 2026-03-15
STD-STND-LOG

@stnd/log

@stnd/log

Centralized logging for the Standard framework. Colored, leveled, scoped terminal output.

Install

npm install @stnd/log

Usage

Static methods (quick & easy)

import Log from “@stnd/log”;

Log.info(“Server started on port 3000”);
Log.success(“Build complete”);
Log.warn(“Deprecated API usage”);
Log.error(“Connection failed”);
Log.debug(“Raw payload:”, data);

Static methods with scope

When multiple arguments are passed, the first is treated as a scope:

Log.info(“Markdown”, “Processing 42 files…”);
Log.warn(“Build”, “Missing config, using defaults”);
Log.error(“Auth”, “Token expired”);

Instance-based (persistent scope)

Create a scoped instance when logging repeatedly from the same module:

const log = Log({ scope: “Markdown” });

log.info(“Processing files…”);
log.success(“Compiled 42 files”);
log.warn(“Missing frontmatter in post.md”);
log.error(“Failed to parse YAML”, error);
log.debug(“Raw block data:”, blockData);
Log.banner(“0.18.0”);
Log.banner(“0.18.0”, “https://custom.url”);
Log.bannerSuccess(“Build complete!”);

Fatal (throws)

log.fatal(“Missing required config”); // logs then throws Error

Log levels

Level Value Description
DEBUG 0 Development debugging
INFO 1 General information (default in dev)
WARN 2 Warnings (default in production)
ERROR 3 Errors only
NONE 4 Silent

Setting the level

Priority order (highest wins):

  1. Explicit optionLog({ level: ‘DEBUG’ })
  2. Global configglobalThis.__STANDARD_CONFIG__.logLevel
  3. Environment variableSTND_LOG_LEVEL or LOG_LEVEL
  4. DefaultINFO in development, WARN in production
// Instance with explicit level
const log = Log({ level: “DEBUG”, scope: “Loader” });

// Or via environment
// STND_LOG_LEVEL=DEBUG node build.js

Accessing levels programmatically

Log.LEVELS.DEBUG; // 0
Log.LEVELS.INFO; // 1
Log.LEVELS.WARN; // 2
Log.LEVELS.ERROR; // 3
Log.LEVELS.NONE; // 4

License

MIT

Standard OS — stnd.buildSTD-STND-LOG · rev. 2026-03-15