0.1.2 • Published 1 year ago
@topper3418/app-logger v0.1.2
MERN Logger
A logger for the MERN (MongoDB, Express.js, React.js, Node.js) stack.
Description
This project provides a logging solution for MERN applications. It consists of the following components:
- Server: A server that can receive and return logs.
- Logging API: Both client-side and server-side APIs for logging.
- Log Retrieval: A route for retrieving logs.
- Log Addition: A route for adding logs.
- Log Model: A model for handling different types of log reading and writing.
Installation
Clone the repository:
git clone https://github.com/topper3418/app-logger.git
Install dependencies:
cd mern-logger npm install
Configure the server:
- Update the database connection details in
config.js
. - Customize any other configuration options as needed.
- Update the database connection details in
Start the server:
npm start
Usage
To use the logger in your MERN application, follow these steps:
Import the logging API on the client-side:
import { log } from 'mern-logger';
Use the logging API to log events:
log('info', 'User logged in');
Retrieve logs on the server-side:
const logs = await Log.find();
Add logs on the server-side:
const newLog = new Log({ message: 'New log entry' }); await newLog.save();
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
License
This project is licensed under the MIT License.