Audit and Logs
The Core's audit helper formats console messages, optionally writes them to files, and provides the configured crash handler. Packs receive a logs function through their equipments. Use it to keep output consistent with the project's audit settings.
Log Messages
The short form takes a type and a message. A trailing boolean requests file output. The long form supplies a sector and icon as well. Use all four text arguments in the long form; the old three-argument sector example is incompatible with the current argument parser.
logs('message', 'The application is ready')
logs('warn', 'A required resource is unavailable', true)
logs(
'info',
'sometarget',
'M',
'The layer initialized successfully',
true
)
Supported types include message, error, violation, warn, info, success, subset, list, and marked. Error and warning types select their standard icons and colours. The single-argument commands clear, newline, and line format console output.
logs('line')
logs('newline')
Audit Settings
Configure config.engineopt.audit in the project's config.js. Merge the following engineopt branch into the exported config object, preserving its other settings. printlog enables file writing. printdebug requests file output for formatted messages even when the call omits its save flag. logWarn=false suppresses warning messages, including their file output. logLibs and logLayered control the additional messages emitted by their callers.
// config.js -> config (merge into the exported object)
engineopt: {
audit: {
logDebug: false,
logDeeply: false,
logWarn: true,
logLibs: true,
logLayered: true,
printlog: true,
printdebug: false
}
}
A call's true flag still requires printlog to be enabled for the file writer to save it. Logs contain the text supplied by the caller. Redact secret values and sensitive application data before passing them to the helper.
Extra Information and Execution Depth
logDebug and logDeeply are independent flags in engineopt.audit. They give developers and agents two controls for choosing how much extra information and internal detail to expose. When adding logs to a pack, follow the convention below. The Core and individual packs read these flags at the points where they emit the additional output.
- logDebug enables extra information that is normally unnecessary for routine operation. Use it for optional context such as selected settings, decisions, dependency details, or additional status messages. Enable it whenever that extra visibility is useful.
- logDeeply enables deeper tracing through intermediate steps, internal branches, nested operations, and the path followed through an implementation.
Enable either flag on its own, both, or neither. Choose which messages belong to each flag and where to place the checks in your code. Keep messages needed for ordinary operation in the normal log flow. This convention gives the flags a shared meaning while leaving the developer or agent responsible for the useful level of detail in each component.
if (config.engineopt.audit.logDebug === true) {
logs('info', 'sometarget', '', 'Selected connection adapter is native')
}
if (config.engineopt.audit.logDeeply === true) {
logs('info', 'sometarget', '', 'Connection step 2: validating adapter options')
}
These checks belong in the code emitting the messages. logs() formats the calls it receives; it does not assign them a debug or depth level automatically. Existing packs choose their own instrumentation. File persistence remains controlled by the save flag, printdebug, and printlog.
Log Files
The configured logs directory defaults to system-logs. File output is appended to a daily YYYY-MM-DD.log file in the sector directory and in the combined --- directory. Files use Markdown-style table rows with time, target, and message fields.
system-logs/
βββ ---/
β βββ YYYY-MM-DD.log
βββ engine/
βββ sometarget/
βββ YYYY-MM-DD.log
The helper does not automatically create a separate crash archive, rotate old files, or sign log contents. Configure retention and access for the deployment where logs are kept. Reported write failures appear on the console.
Crash Behaviour
engineopt.ebehavor controls the Core crash handler. exit terminates with status 1. stop opens an interactive prompt asking whether to close the process. Other values leave those actions disabled.
The Core registers handlers for uncaught exceptions, unhandled rejections, and SIGINT. Core audit messages can invoke its crash callback. The logs function supplied to packs has that callback disabled, so logging an error from a pack prints the message without invoking the Core's crash handler. Throw or return a failure according to the pack's lifecycle contract when it cannot continue.
File output follows the save flag and audit settings even for critical messages. A console error alone does not establish that a corresponding file was written.