Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/michael-tiger-2010/wyvernjs/llms.txt

Use this file to discover all available pages before exploring further.

ShuiHu (sh) is WyvernJS’s logging and performance-timing module. It wraps console.log, console.warn, and console.error with timestamped, labeled log entries stored in an in-memory history, and provides a proxy-based step benchmarking system using Uint32Array for minimal overhead. Every log call records a { statement, context, label, timestamp } object internally, giving you a queryable history of everything your application has logged at runtime.

Log Levels

ShuiHu defines four severity levels. Each level maps to a numeric value used when filtering log output:
LevelNumeric valueNotes
debug0General-purpose diagnostic output
warn1Non-fatal conditions worth attention
error2Recoverable failures
dire3Critical failures — highest severity
sh.log is a direct alias for sh.debug and behaves identically.
A benchmark label also exists internally at level 0. It is used automatically by sh.time when a timer is stopped and cannot be called directly — there is no sh.benchmark() method. Because it shares level 0 with debug, benchmark reports are included whenever you filter at 'debug' (the default).
sh.log('User logged in');               // debug level
sh.debug('Fetching items', { url });    // debug with context
sh.warn('Cache miss', { key });         // warn
sh.error('Request failed', { status }); // error
sh.dire('Database unreachable');        // dire — highest severity

Environment

ShuiHu requires ES9+. The core logging methods (log, debug, warn, error, dire, outputLogs, clear, setUpdateFn) and the sh.time benchmarking system work on any ES9+ JavaScript interpreter. The DOM helpers sh.createLogHolder() and sh.outputElementLogs() are browser-only and additionally depend on DiWu (dw.init()) for DOM manipulation.

Explore ShuiHu

Logging

Log methods, in-memory history, filtering with outputLogs, live update callbacks, and DOM log output.

Benchmarking

Proxy-based step timers with sh.time, Uint32Array storage, and formatted benchmark reports.

Build docs developers (and LLMs) love