Quick-logger-be is a tool that allows developers to quickly add a logger to gather information from their backend application.
- Pre-configured logger
- Ability to set the log level and messages
- Logs that are output to the console, written to a file, and sent to a user-provided API endpoint
npm i quick-logger-be
In order to send your logs to an API, you will need to provide the desired API endpoint.
Create a .env file in the root directory. See the .env.Example file for formatting.
.env file:
LOGS_API_ENDPOINT= //insert API endpoint here
If you are using Webpack v.5 or later, you might also need to install the node-polyfill-webpack-plugin.
Install the package:
npm install node-polyfill-webpack-plugin
Add the plugin to your webpack.config file. Example:
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
\\Other rules...
plugins: [
new NodePolyfillPlugin()
]
};
Configure the logger and transports.
Example:
const { loggerBeConfig } = require('quick-logger-be');
app.use(loggerBeConfig());
Add the logger into your application in the places where you want to trigger a log.
Customize the message and log level (info, debug, warn, error).
Example:
const { logger } = require('quick-logger-be');
myFunctionToWatch () => {
//do something
logger.info(//message string);
logger.debug(//message string)
logger.warn(//message string)
logger.error(//message string)
}
Contributing to the project: See the Github repo
Built with:
Authors:
- Crystal Pederson | GitHub | LinkedIn
- Andrés Gutiérrez | Github | LinkedIn
- Kylene Hohman | Github | LinkedIn
- Felicity Nguyen | Github | LinkedIn
Distributed under the MIT License