JSPM

logger-standard

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q29972F
  • License ISC

A simple and flexible logging utility for Node.js applications. 🚀

Package Exports

  • logger-standard
  • logger-standard/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (logger-standard) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

📝 logger-standard

A simple and flexible logging utility for Node.js applications. 🚀

đŸ› ī¸ Installation

npm install logger-standard

🚀 Usage

import { Logger } from 'logger-standard';

// Create a new logger instance
const logger = new Logger({
  service: 'MyService',
  showDate: true
});

// Basic logging
logger.info('This is an info message');
logger.error('This is an error message');
logger.warn('This is a warning message');
logger.log('This is a regular log message');

// Logging with sensor ID
logger.info('Temperature reading', 'TEMP001');

📚 API

Constructor

new Logger(options)
  • options.service (string): Prefix for all log messages. Default: ''
  • options.showDate (boolean): Include timestamp in log messages. Default: false

Methods

  • info(message, sensorId): Log an info message â„šī¸
  • error(message, sensorId): Log an error message ❌
  • warn(message, sensorId): Log a warning message âš ī¸
  • log(message, sensorId): Log a regular message đŸ“ĸ

All methods accept two parameters:

  • message (string): The message to log
  • sensorId (string, optional): An identifier for the source of the log

đŸ–¨ī¸ Output Format

The log output format is as follows:

[Timestamp (if enabled)] [Service Name] Message (sensorId: SensorID)

🔗 Dependencies

This package relies on the following npm packages for colored console output:

  • console-error
  • console-info
  • console-warn

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

🐛 Issues

If you encounter any problems or have any questions, please open an issue in the GitHub repository.

📜 License

This project is licensed under the ISC License.

🏠 Repository

https://github.com/nivkman/logger-standard