bare-system-logger
System logger for Bare
Documented against
v1.0.7stable
bare-system-logger — System logger for Bare. It is a native addon.
npm i bare-system-loggerUsage
const SystemLog = require('bare-system-logger')
const log = new SystemLog()
log.info('Hello %s', 'world!')API
SystemLog
clear(): void
Clears the log output. A no-op on the base Log.
colors: boolean
Whether this logger applies ANSI color styling to formatted output. Read-only. Always false for a SystemLog.
debug(...data: unknown[]): void
Logs data at debug level.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
data | unknown[] | — | Values to format and log; the first may be a printf-style format string (for example %s, %d, %o) with the remaining values as substitutions. |
error(...data: unknown[]): void
Logs data at error level.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
data | unknown[] | — | Values to format and log; the first may be a printf-style format string (for example %s, %d, %o) with the remaining values as substitutions. |
fatal(...data: unknown[]): void
Logs data at fatal level, then ends the process at once with exit code 1, so exit handlers don't run.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
data | unknown[] | — | Values to format and log; the first may be a printf-style format string (for example %s, %d, %o) with the remaining values as substitutions. |
format(...data: unknown[]): string
Formats data the same way debug, info, warn, error, and fatal do, and returns the resulting string without logging it.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
data | unknown[] | — | Values to format; the first may be a printf-style format string (for example %s, %d, %o) with the remaining values as substitutions. |
info(...data: unknown[]): void
Logs data at info level.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
data | unknown[] | — | Values to format and log; the first may be a printf-style format string (for example %s, %d, %o) with the remaining values as substitutions. |
warn(...data: unknown[]): void
Logs data at warn level.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
data | unknown[] | — | Values to format and log; the first may be a printf-style format string (for example %s, %d, %o) with the remaining values as substitutions. |
See also
- Builds on
bare-logger. - On FreeRTOS, which has no system log, records go to standard error, which the firmware routes to its console. Added in v1.0.7, through the FreeRTOS backend of
liblog. - Bare modules — the full
bare-*catalog. - Bare runtime API — the runtime these modules extend.
Last updated on
Was this helpful?