cf-logger-p v6.0.0
CF-Logger-Package
CF-Logger-Package contains Logging methods that can be utilized as a unified logging mechanism across all cf codebase.
Logging Levels
The supported logging levels are listed down based on priority.
- error: 0
- info: 1
- debug: 2
- warning: 3
Built With
Technologies & plugins used to create this application
- Typescript - Syntactical superset of JavaScript
- node.js - Evented I/O for the backend
- Winston - A nodejs logging library
Using This Private Repository as a Dependency
Prerequisites
1. Setup node & npm
This is an example of how to list things you need to use the application and how to install them.
- Node.Js: Setup node and npm
1. Install the package
Install this package using the following command:
Then install your dependencies using the command
```bash
npm install cf-logger-package
Usage
// Import package
import LoggerOps from 'cf-logger-package'
// Create Logger instance & pass the logging level you want to set
const Logger = new LoggerOps('error')
//create a middleware function to attach a traceid with reach API request
app.use(function (req, res, next) {
Logger.setTraceId(uuidv4());
next();
})
// Use the following methods to log data
//Debug: The debug log should be created in the local & development environments. It should contain the information which will help developers to debug a problem. The following method can be used for the same:
Logger.logDebug(msg: string, obj: object)
//Error: The error log should be created in all environments in case of occurrence of an error. This can usually be implemented in the places where you are catching errors.The following method can be used for the same:
Logger.logError(msg: string, obj: object)
//Info: The info log should be created in the local & development environments. It should contain the information which will help developers to determine the current state of the application & informational statements regarding program execution. It can be used for application behaviour tracking. The following method can be used for the same:
Logger.logInfo(msg: string, obj: object)
//* Warning: The warning log should be created in the local & development environments. It should contain the information which will help developers to determine potentially harmful state of the application in real time but may not terminate the existing functionality or application processing.
Logger.logWarning(msg: string, obj: object)
// All the log methods accept two parameters :
// 1. Message:(dataType: string)
// 2. Metadata: (dataType: object)
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago