typescript-logging-log4ts-style is a logging library for TypeScript projects, providing a Log4TS-inspired flavor built upon the `typescript-logging` core. It allows developers to create hierarchical loggers based on unique names, often corresponding to namespaces or logical groups (e.g., 'service.Account'). The library emphasizes structured output and dynamic control over logging levels. The current stable version is 2.2.0, with regular updates incorporating new features like file logging and rollover support as seen in version 2.2.0. It differentiates itself by offering a familiar log4j-like API and configuration patterns, making it approachable for developers accustomed to enterprise logging solutions, while integrating seamlessly into modern TypeScript environments. Its modular design as a 'flavor' allows users to choose the logging style that best fits their project's needs.
npm install typescript-logging-log4ts-styleVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates setting up a Log4TSProvider, configuring log levels and groups, creating named loggers, and using them across different modules for debugging and error logging.
Refer to the migration guide available in the `typescript-logging` repository for 1.x releases (e.g., `https://github.com/vauxite-org/typescript-logging/tree/release-1.x`) and rewrite logging configuration and calls for the 2.x API.
Always install both packages: `npm install --save typescript-logging typescript-logging-log4ts-style`.
Review existing code that interacts directly with `LogLevel` values or performs custom comparisons to ensure compatibility with the new `LogLevel.Off` value.
Install `npm install --save typescript-logging-node-channel` and consult its documentation for configuration details to enable file output.
Ensure both `typescript-logging` and `typescript-logging-log4ts-style` are installed: `npm install --save typescript-logging typescript-logging-log4ts-style`.
Verify that `Log4TSProvider.createProvider` is called before any `getLogger` calls, and that the provider object is correctly exported and imported across modules.
Adjust the `level` property in your `Log4TSProvider` configuration (e.g., to `LogLevel.Debug` or `LogLevel.Trace`) and ensure group expressions match your logger names.
Use ES Module `import` syntax (e.g., `import { Log4TSProvider } from 'typescript-logging-log4ts-style';`) and ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`).