Modules@robinpath/log

@robinpath/log

0.1.1Public

Structured logging with levels, file output, JSON format, timers, and grouping

@robinpath/log

Structured logging with levels, file output, JSON format, timers, and grouping

Category Functions Auth License

Why use this module?

The log module lets you:

  • Log a message at DEBUG level to stdout
  • Log a message at INFO level to stdout
  • Log a message at WARN level to stderr
  • Log a message at ERROR level to stderr
  • Log a message at FATAL level to stderr

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/log

Quick Start

No credentials needed — start using it right away:

log.info "Server started on port" $port

Available Functions

FunctionDescription
log.debugLog a message at DEBUG level to stdout
log.infoLog a message at INFO level to stdout
log.warnLog a message at WARN level to stderr
log.errorLog a message at ERROR level to stderr
log.fatalLog a message at FATAL level to stderr
log.setLevelSet the minimum log level; messages below this level are suppressed
log.getLevelGet the current minimum log level as a string
log.setFileSet a file path to append log output to in addition to stdout/stderr
log.setFormatSet the output format for log messages
log.clearReset all log settings to defaults (info level, no file, text format)
log.tablePretty-print an array of objects as a table to stdout
log.groupPrint a group header and increase indentation for subsequent log messages
log.groupEndEnd the current group and decrease indentation
log.timeStart a named timer
log.timeEndStop a named timer and log the elapsed time in milliseconds

Examples

Log a message at INFO level to stdout

log.info "Server started on port" $port

Log a message at WARN level to stderr

log.warn "Deprecated function called"

Log a message at ERROR level to stderr

log.error "Failed to connect:" $err

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/log";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  log.info "Server started on port" $port
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.1latestyesterday
Install
$ robinpath install @robinpath/log
Version0.1.1
LicenseMIT
Unpacked Size5.7 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

utilities