Skip to main content

license GitHub Repo stars

Getting Started with the xPack Logger

This project provides a TypeScript Node.js CommonJS/ES6 module with a re-entrant console logger suitable for REPL/server/multi-instance use cases.

note

Compatibility with legacy CommonJS is required until VS Code extensions will be updated to import ES6 modules.

The open source project is hosted on GitHub as xpack/logger-ts and is published on npmjs.com as @xpack/logger.

Install

The xPack Logger is a npm package available as @xpack/logger from the npmjs.com public registry and can be installed via npm.

tip

The simplest way to obtain the install command is from the web homepage. Just hover your mouse over the command, and a copy button will appear on the right side. Click it to copy the command.

For detailed installation instructions, please refer to the Install Guide page.

Status

The @xpack/logger module is fully functional and stable.

This module is primarily intended to be included in projects like the xpm CLI application.

Compatibility notices

According to SemVer rules:

Major version X (X.y.z | X > 0) MUST be incremented if any backwards incompatible changes are introduced to the public API.

v6.0.0

The TypeScript code is compiled into CommonJS modules, with an ES6 wrapper, and can be consumed by both TypeScript and JavaScript packages.

There were also some minor internal renames, but this should not be a problem.

The function isLevel(level) was added.

v5.0.0

For consistency reasons, hasLevel was changed from a method to an accessor.

Internally, the log level starts as undefined instead of the string 'undefined', as in previous versions.

This should not be a problem, given that the method to check if the level was set is via hasLevel().

v4.0.0

The code was migrated to TypeScript.

The migration itself should not introduce any incompatibilities, actually it should be fairly compatible with the latest v3.x, but, for just in case, the safer path was to consider it a major release.

v3.0.0

All isXyx functions (returning a boolean related to the log level) were changed to accessors.

v2.0.0

The logger constructor was changed to use a generic parameters object.

If upgrading from previous versions, change the syntax from:

const log = new Logger(console, 'info')

to:

const log = new Logger({
console,
level: 'info'
})

Maintainer & Developer info

For information specific to maintainers and developers, please refer to the separate Maintainer Information and Developer Information pages.

License

The original content is released under the MIT License, with all rights reserved to Liviu Ionescu.

Enjoyed using this project? Let us know!

If you enjoyed using this project, please let us know! Here are some ways you can show your support:

  • Donate: Your contributions (small or generous) help us keep the xPack projects thriving. Donate
  • Star the project on GitHub: It helps others discover our work.
  • Follow us on X/Twitter: Stay updated with our latest releases and news.