Class Logger

screenshot of Class Logger

Boilerplate-free decorator-based class logging

Overview:

Class-logger is an innovative logging solution designed to streamline the process of tracking method calls and class instantiations in applications built with TypeScript. With its decorator-based approach, it offers developers a clean and efficient way to enhance their logging capabilities without compromising code clarity or performance. Whether running in a Node.js environment or directly in the browser, class-logger adapts seamlessly to provide valuable insights into your application's behavior.

The tool is highly configurable, allowing developers to customize logging settings at multiple levels—from global configurations down to individual class and method settings. This flexibility ensures that relevant information is logged while minimizing unnecessary noise. With features designed to log not only method calls but also error handling and instance details, class-logger emerges as an essential tool for anyone looking to improve application debugging and monitoring.

Features:

  • Decorator-Based Logging: Easily log class methods and construction using simple decorators, enhancing code readability.
  • Flexible Configuration: Supports global, class-specific, and method-specific configurations for tailored logging behavior.
  • Supports Node.js and Browsers: Compatible across various environments, making it versatile for both server-side and client-side applications.
  • Error Handling and Re-throwing: Automatically logs any thrown errors during method execution and re-throws them for downstream handling.
  • Formatted Class Instances: Option to include a formatted class instance in log messages, providing relevant context without cluttering the logs.
  • Asynchronous Logging: Handles both synchronous and asynchronous method calls, ensuring comprehensive tracking of all actions.
  • Customizable Output: Log messages can be formatted with timestamps and other features to enhance clarity and usability.
  • Proxy Support: Leverages JavaScript's Proxy for efficient logging, ensuring compatibility with modern environments while enhancing performance.
typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.