0.1.11 • Published 1 year ago

custom-logging-module v0.1.11

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Custom Logger Package

Overview

This Custom Logger package is designed to provide a comprehensive logging solution for Node.js applications. It supports various logging levels, customizable styling for terminal output, and a structured approach to managing main processes and subprocesses logging. It's structured to encourage modularity and ease of use, making it a suitable choice for both small and large-scale applications.

Features

  • Logging Levels: Supports multiple logging levels (e.g., TRACE, DEBUG, INFO, WARN, ERROR).
  • Styling: Customizable styling options for terminal output, including color coding, to enhance readability.
  • Main and Subprocess Management: Facilitates structured logging by distinguishing between main processes and subprocesses, enabling better traceability and organization.

To use the Custom Logger in your project, follow these steps:

Installation

First, add the Custom Logger package to your project using npm: npm install custom-logger-package-name

Usage

  • Initialize the Main Process Logger:

Before logging from any part of your application, you must initialize the Main Process Logger. This step sets up the logging service and applies the initial configuration. You can either inject logger or extend it.

import { LoggerClient, LoggerMode, MainProcessLoggerConfig, LogLevel } from "custom-logging-module";

class MyApp extends LoggerClient { constructor() { super(new MainProcessLoggerConfig("MyApp", LoggerMode.COLORED, LogLevel.INFO)); } }

const app = new MyApp(); app.log(LogLevel.INFO, "Application started.");

  • Logging from a Subprocess:

For logging in a submodule or subprocess, instantiate a LoggerClient with a SubProcessLoggerConfig. Ensure to specify the name of the main process it belongs to for proper association.

import { LoggerClient, SubProcessLoggerConfig, LogLevel } from "custom-logging-module";

class DataService extends LoggerClient { constructor(mainProcessName: string) { super(new SubProcessLoggerConfig("DataService", mainProcessName)); }

fetchData() {
    this.log(LogLevel.INFO, "Fetching data...");
    // Data fetching logic...
}

}

const dataService = new DataService("MyApp"); dataService.fetchData();

Configuration

The Custom Logger allows for detailed configuration of logging behavior and styles. Modify the logging level, mode (classic, colored, or docker), and terminal output styles using the LoggerConfig and LoggerStylesConfig classes.

Documentation

TO DO

Contributing

Contributions are welcome! If you'd like to improve the Custom Logger package, please feel free to fork the repository, make your changes, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

0.0.100

1 year ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.0.99

1 year ago

0.0.84

1 year ago

0.0.85

1 year ago

0.0.86

1 year ago

0.0.87

1 year ago

0.0.88

1 year ago

0.0.89

1 year ago

0.0.80

1 year ago

0.0.81

1 year ago

0.0.82

1 year ago

0.0.83

1 year ago

0.0.73

1 year ago

0.0.74

1 year ago

0.0.75

1 year ago

0.0.76

1 year ago

0.0.77

1 year ago

0.0.78

1 year ago

0.0.79

1 year ago

0.0.70

1 year ago

0.0.71

1 year ago

0.0.72

1 year ago

0.0.62

1 year ago

0.0.63

1 year ago

0.0.64

1 year ago

0.0.65

1 year ago

0.0.66

1 year ago

0.0.67

1 year ago

0.0.68

1 year ago

0.0.69

1 year ago

0.0.60

1 year ago

0.0.61

1 year ago

0.0.59

1 year ago

0.0.51

1 year ago

0.0.52

1 year ago

0.0.54

1 year ago

0.0.55

1 year ago

0.0.56

1 year ago

0.0.57

1 year ago

0.0.58

1 year ago

0.0.50

1 year ago

0.0.48

1 year ago

0.0.49

1 year ago

0.0.95

1 year ago

0.0.96

1 year ago

0.0.98

1 year ago

0.0.90

1 year ago

0.0.91

1 year ago

0.0.92

1 year ago

0.0.93

1 year ago

0.0.94

1 year ago

0.0.40

1 year ago

0.0.41

1 year ago

0.0.42

1 year ago

0.0.43

1 year ago

0.0.44

1 year ago

0.0.45

1 year ago

0.0.46

1 year ago

0.0.47

1 year ago

0.0.38

1 year ago

0.0.39

1 year ago

0.0.37

1 year ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.33

1 year ago

0.0.34

1 year ago

0.0.35

1 year ago

0.0.36

1 year ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.28

1 year ago

0.0.29

1 year ago

0.0.20

1 year ago

0.0.21

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.24

1 year ago

0.0.25

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago