@offirmo/practical-logger-types
v3.0.1
Published
TypeScript types for Offirmo’s practical logger (no code)
Downloads
36
Readme
This is an internal module of Offirmo’s practical logger.
- declares only TypeScript types
- No code, 0 bytes = will do nothing to your bundle size
- no dependencies
Usage
This is most likely not what you are looking for!
See the actual implementations of those interfaces:
- minimal no-op: @offirmo/practical-logger-minimal-noop
- browser: @offirmo/practical-logger-browser
- node: @offirmo/practical-logger-node
Interface
A logger will have the following interface:
setLevel(level: LogLevel): void
getLevel(): LogLevel
addCommonDetails(hash: Readonly<{ [k: string]: any }>): void
- Log primitives: (mirroring the log levels)
fatal(message?: string, details?: Readonly<{ [k: string]: any }>): void
emerg(…) idem
alert(…) idem
crit(…) idem
error(…) idem
warning(…), warn(…) idem
notice(…) idem
info(…) idem
verbose(…) idem
log(…) idem
debug(…) idem
trace(…) idem
silly(…) idem
- those functions are present for convenience but may not do anything (platform-dependent):
group(groupTitle?: string): void
groupCollapsed(groupTitle?: string): void
groupEnd(): void
Concept
Other loggers:
- http://getpino.io/#/docs/benchmarks
- discovered later: https://github.com/ianstormtaylor/browser-logger
Credits
I had a look at bunyan's interface.