Expand description
Type Aliases§
Source§type Log Level Str = "off" | "default" | "info" | "debug"
type Log Level Str = "off" | "default" | "info" | "debug"
Functions§
Source§logger(name: string, args: LoggerConstructor): Logger
logger(name: string, args: LoggerConstructor): Logger
Create a logger creator. Use the factory methods to finish making the logger
Interfaces§
- Logger
The logger type
- LoggerConstructor
Args for constructing a logger
Client side log util
This is rather simple logging stuff with the primary focus being easy-to-debug, instead of optimized for bundle size or performance.
Because this library doesn't have global states, there is no "global" logger or any global logger settings. Instead, each library or component of the application can create their own instance of the logger, which stores settings like the name, color and level of that logger.
It's recommended that a library exports the logger object so downstream app can modify the logging level if needed for debugging.
Due to the nature of JS, all logging calls, even when turned off, will incur some small runtime overhead. While we could remove debug calls for release build, that's currently not done (and it would require bundler to inline the call to remove the call completely, which might not be the case)