TypeScript Logging is a core library designed for adding robust logging capabilities to both web and Node.js projects. It is currently at version 2.2.0 and is actively maintained, with minor releases adding new features such as file logging and rollover support via the `typescript-logging-node-channel` package. This package serves as the foundation; users must also install a specific 'flavor' package (e.g., `typescript-logging-category-style` or `typescript-logging-log4ts-style`) to gain concrete logging implementations and APIs. Version 2.x, a complete rewrite, is not compatible with version 1.x. Key differentiators include offering two distinct API styles: a hierarchical, category-based approach and a style mimicking Log4j/log4ts for familiarity, providing flexibility for different development preferences.
npm install typescript-loggingVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to configure the Category-style logging provider and obtain hierarchical loggers for different modules, logging messages at various levels.
Refer to the migration guide in the package documentation (`/migration` section) and update all logging logic to conform to the new v2 API structure. This typically involves updating imports and logger initialization.
Install your preferred flavor package (e.g., `npm install --save typescript-logging-category-style`) and follow its documentation to set up the logging provider and obtain logger instances.
Review any log level configurations that might be impacted by the introduction of `LogLevel.Off`. Explicitly use `LogLevel.Off` where logging should be completely disabled, or other specific levels for active logging.
Ensure you are importing the provider from the correct 'flavor' package, e.g., `import {CategoryProvider} from 'typescript-logging-category-style';` and that the flavor package is installed.Install the required flavor package using npm: `npm install --save typescript-logging-category-style` (or your chosen flavor) and verify the import statement correctly references the package name and export.