diary
diary copied to clipboard
feat: nested diaries
closes #12 by implementing the 3rd proposal. It ended up being very straightforward to implement, thanks to the simple and clear codebase.
Feature description
Allows diary inheritance by returning the diary()
function from itself. Automatically prefixes the child diary with the name of its parent, and passes through the onEmit callback if no explicit callback is provided (similar behavior to class inheritance).
Also adds a readme section to explain the usage, and tests.
Benchmark results:
main branch
@graphile/logger x 20,047,626 ops/sec ±2.65% (86 runs sampled)
bunyan x 142,311 ops/sec ±0.29% (96 runs sampled)
debug x 205,040 ops/sec ±2.78% (87 runs sampled)
diary x 5,927,876 ops/sec ±0.95% (90 runs sampled)
pino x 43,152 ops/sec ±2.02% (91 runs sampled)
roarr x 730,335 ops/sec ±2.00% (87 runs sampled)
ulog x 22,671 ops/sec ±28.49% (17 runs sampled)
winston x 9,505 ops/sec ±10.77% (76 runs sampled)
PR branch
@graphile/logger x 20,185,277 ops/sec ±1.80% (87 runs sampled)
bunyan x 132,733 ops/sec ±0.19% (97 runs sampled)
debug x 203,339 ops/sec ±2.80% (84 runs sampled)
diary x 5,634,838 ops/sec ±0.83% (93 runs sampled)
pino x 45,969 ops/sec ±1.98% (93 runs sampled)
roarr x 746,780 ops/sec ±2.02% (87 runs sampled)
ulog x 22,849 ops/sec ±25.67% (19 runs sampled)
winston x 10,972 ops/sec ±9.08% (83 runs sampled)