Skip to content

Releases: christoph-fricke/logging-library

v0.5.0

19 Dec 16:52
Compare
Choose a tag to compare

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 to LogRecord.
    • 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

15 Sep 11:10
Compare
Choose a tag to compare

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

20 Aug 15:58
Compare
Choose a tag to compare

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

21 Jul 09:47
Compare
Choose a tag to compare

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

08 Jul 21:02
Compare
Choose a tag to compare

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 to verbose.
    • 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

05 Jul 20:18
Compare
Choose a tag to compare

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.
  • Renamed ILogRecord.msg to ILogRecord.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 of ILogRecord.level.

Internal

  • More documentation in the README
  • Added eslint for code linting
  • Updated CI workflow to perform a lint check

v0.1.2

05 Jul 11:02
Compare
Choose a tag to compare

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

04 Jul 22:31
Compare
Choose a tag to compare

Fixes

  • Fix description in package.json.
  • Add homepage with link to typedocs in package.json.

v0.1.0

04 Jul 22:12
Compare
Choose a tag to compare

This is the initial release. Notable features include:

  1. Create loggers with new Logger()
  2. Attach handler with logger.attachHandler()
  3. Create loggers scoped to a context with logger.withContext()
  4. Log using 6 different log levels.
  5. Custom log handler via BaseHandler
  6. ConsoleHandler and TestHandler included