Releases: christoph-fricke/logging-library
Releases · christoph-fricke/logging-library
v0.5.0
Features
- Loosens typings of logger methods like
info
,debug
, etc.- The methods now accept multiple arguments.
- Passed arguments can have any type instead of only accepting a string.
- Added a
args: unknown[]
property toLogRecord
.- Property contains all arguments passed to a logger.
- The
message
property contains all arguments formatted to a string. Multiple arguments are separated by a space.
Examples:
logger.info({ key1: "value", key2: 123 }) // => "{"key1":"value",key2:123}"
logger.verbose("Hello", "World") // => "Hello Word"
logger.debug([1, 2, 3], [4, 5, 6]) // => "[1,2,3] [4,5,6]"
logger.warn((a,b) => a+b) // => "[Function (anonymous)]"
Documentation
- Changes issue badge to show the open issues instead of all issues.
Internal
- Removes auto mock clearing in jest.
- Upgraded dev-dependencies.
v0.4.1
Fixes
- Fix bad auto-imports in VSCode (hopefully)
- I noticied bad auto imports in vscode when using this library. Code tries to import from "logging-library/lib/types" and not "logging-library".
Internal
- Updates dev dependencies.
v0.4.0
Features
ConsoleHandler.toggle
now returns the resulting active state as a boolean (true == console outputs active).- This should make it easier to persist the toggle state so it can be restored after a browser refresh.
Documentation
- The example folder contains an example for colored output using chalk.
v0.3.1
Fixes
- Logger passed different record objects to each handler. The handlers now receive the same record object.
- This wasn't a really big deal but in theory it means that the timestamp would be slightly different for each handler. It is definitely better to have a record, stored at different locations, use the same timestamp.
Internal
- Upgraded dev-dependencies. This also solved any
npm audit
warnings.
v0.3.0
Features
- Handler can log only for specific levels. (#5)
- Add custom metadata to a logger with is passed to all handlers (#7)
- Renamed log level
trace
toverbose
.- This change better reflects the purpose of this level.
Internal
- Changed trigger for publish workflow. It should hopefully work with drafted released now.
- Pre-commit hook now runs tests for all changed files
- Changed all .toEqual() test asserts to .toStrictEqual()
v0.2.0
Features
ConsoleHandler
now accepts a custom format function which is applied to every record logged to the console. (#2)- Added optional options argument in the constructor of
ConsoleHandler
.- Options contain a key for a custom format function.
- Added optional options argument in the constructor of
- Renamed
ILogRecord.msg
toILogRecord.message
. - Changed
ConsoleHandler
default format to:LEVEL: [context] - message
- This should be more useful in a browser enviromnent where timestamps can also be displayed in the dev console.
- Added
ILogRecord.levelName
which is a readable name ofILogRecord.level
.
Internal
- More documentation in the README
- Added eslint for code linting
- Updated CI workflow to perform a lint check
v0.1.2
Fixes
package.json
now contains the right repository link- Updates to the README
- Remove type declarations for test files from the bundle (#1)
Internal
- Exports in
index.ts
are now explicit. Prevents accidental exports in the future. - Typedoc only shows types for constructs that are actually exported by the library now.
v0.1.1
Fixes
- Fix description in
package.json
. - Add homepage with link to typedocs in
package.json
.
v0.1.0
This is the initial release. Notable features include:
- Create loggers with
new Logger()
- Attach handler with
logger.attachHandler()
- Create loggers scoped to a context with
logger.withContext()
- Log using 6 different log levels.
- Custom log handler via
BaseHandler
ConsoleHandler
andTestHandler
included