@parity/product-sdk-logger
Structured, namespace-filtered logging for the SDK.
Each package calls createLogger(namespace) to emit structured LogEntry
records; the host application calls configure once to set the log level,
decide which namespaces are enabled, and route entries into its own
observability stack via a custom LogHandler.
npm install @parity/product-sdk-loggerExports
Functions
| Name | Summary |
|---|---|
configure() | Apply global logger configuration. Merges into prior settings — passed fields |
createLogger() | Create a Logger bound to a namespace. |
Interfaces
| Name | Summary |
|---|---|
LogEntry | A structured record emitted by a Logger. |
Logger | A namespaced logger. Each method emits a LogEntry at the matching LogLevel, or no-ops when filtered out by the current configuration. |
LoggerConfig | Global configuration for the logger system, applied via configure. |
Type Aliases
| Name | Summary |
|---|---|
LogHandler | Custom sink for log records. When set via configure it replaces the default console.* output and receives every LogEntry that passes the level filter. |
LogLevel | Severity ranking — "error" is the highest, then "warn", "info", "debug". The configured level is the lowest severity that gets emitted; less-severe entries are dropped. |
Functions
configure()
Apply global logger configuration. Merges into prior settings — passed fields
replace, omitted fields are left alone — and takes effect immediately for
every Logger, present and future.
configure(config: LoggerConfig): voidcreateLogger()
Create a Logger bound to a namespace.
The namespace is attached to every LogEntry the logger emits and is
what LoggerConfig.namespaces matches against. Convention is
package:area — e.g. "signer:dev", "chain-client".
createLogger(namespace: string): LoggerInterfaces
interface LogEntry
A structured record emitted by a Logger.
Properties
data
unknownlevel
LogLevelmessage
stringnamespace
stringtimestamp
numberinterface Logger
A namespaced logger. Each method emits a LogEntry at the matching LogLevel, or no-ops when filtered out by the current configuration.
Methods
debug
debug(message: string, data?: unknown): voiderror
error(message: string, data?: unknown): voidinfo
info(message: string, data?: unknown): voidwarn
warn(message: string, data?: unknown): voidinterface LoggerConfig
Global configuration for the logger system, applied via configure.
Properties
handler
LogHandlerCustom output handler. Replaces default console output.
level
LogLevelMinimum log level. Default: “warn”
namespaces
string[]If set, only these namespaces use the configured level; others stay at “warn”.
Type Aliases
type LogHandler
Custom sink for log records. When set via configure it replaces the default console.* output and receives every LogEntry that passes the level filter.
type LogHandler = (entry: LogEntry) => voidtype LogLevel
Severity ranking — "error" is the highest, then "warn", "info", "debug". The configured level is the lowest severity that gets emitted; less-severe entries are dropped.
type LogLevel = "error" | "warn" | "info" | "debug"