0.1.2 • Published 1 year ago

@topper3418/app-logger v0.1.2

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

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

  1. Clone the repository:

    git clone https://github.com/topper3418/app-logger.git
  2. Install dependencies:

    cd mern-logger
    npm install
  3. Configure the server:

    • Update the database connection details in config.js.
    • Customize any other configuration options as needed.
  4. Start the server:

    npm start

Usage

To use the logger in your MERN application, follow these steps:

  1. Import the logging API on the client-side:

    import { log } from 'mern-logger';
  2. Use the logging API to log events:

    log('info', 'User logged in');
  3. Retrieve logs on the server-side:

    const logs = await Log.find();
  4. 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.