1.0.0 • Published 3 months ago

reportster v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Reportster

Reportster is a lightweight logging library for Node.js applications, designed to simplify your logging needs with an intuitive API and powerful features.

Reportster - Banner

Features

  • Simple Integration: Easy-to-use API for seamless integration into your Node.js applications.
  • Flexible Configuration: Customize, formats, and timestamp inclusion according to your requirements.
  • ANSI Color Support: Visually appealing terminal output with ANSI color codes.
  • Comprehensive Error Handling: Capture and log error stack traces for thorough error analysis.
  • Modular and Lightweight: No external dependencies, ensuring minimal overhead and easy maintenance.
  • Compatible with ES6 and CommonJS: Supports both ES6 and CommonJS module formats.

Installation

To install Reportster in your Node.js project, simply run:

npm install reportster

Usage

Reportster - Logs Preview

Server-side Logging

const Report = require('reportster')

// Create a report instance with default configuration
const report = new Report()

// Log info messages for server startup
report.info('Server started successfully')
report.info('Listening on port 3000')

Error Handling in Express Middleware

const Report = require('reportster')

// Create a report instance that only logs errors for debugging
const report = new Report({level: 'error'})

// Middleware for handling errors
function errorHandler(err, req, res, next) {
  // Log the error
  report.error(err)

  // Send error response to the client
  res.status(500).send('Internal Server Error')
}

// Apply error handler middleware
app.use(errorHandler)

For more examples please visit the Reportster - API Usage Examples.

License

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