You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added dual esm/cjs output to support ESM consumers.
Changed
Log.addTransport now returns a TransportAddResult object ({ok, errorCode?, errors?}) instead of a boolean, and never throws. Transport construction failures are reported with errorCode: 'transport_init_failed' and the thrown error in errors.
Transport ctor now throws when level is not a valid log level instead of silently defaulting to Levels.NONE.
Fixed
startingGroups now runs at the end of the Log ctor and no longer throws when provided.
make('a.b') no longer creates a group keyed root.a.b whose parent is root instead of root.a, which collided with root.make('a').make('b'). Group ids and parents now always match the full hierarchy.
Ids that are whitespace-only or contain an empty segment ('a..b', '.a') now return null instead of creating a group with a malformed id.
Added
Log.make(id, options?) replaces makeLog as the way to get or create a child log group. makeLog remains as a deprecated alias that calls make, so existing call sites keep working.
A dotted id walks the hierarchy one segment at a time, so root.make('a.b') returns the same log as root.make('a').make('b') and creates missing intermediate groups.
LevelKey string union ('none' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'all' | 'all_custom' | 'all_extended') is accepted anywhere a level bitmask is: Log level methods, Log.log, LogLevel, Transport, and the globalLevel/level options. Levels are still stored and compared as bitmasks internally.
Level arguments also accept an array mixing keys and bitmasks. enableLevel/disableLevel style methods resolve each item to its bitmask and apply it in order, one at a time. set, log, and constructors combine the array with bitwise OR into a single mask.
LevelKeys map from key to bitmask, LevelInput type (number | LevelKey), checkLevelKey type guard, and levelMask helper that resolves a key, bitmask, or array to a bitmask, or null when any input is invalid.