purpl-logger
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Logger

Date and prepend/append logs to your log file(s) with a simple function.

The documentation is available here.

Installation

  • With npm: npm install --save purpl-logger

  • With yarn: npm add purpl-logger

Usage

  • Logging to logs.txt (default path):
const { log } = require('purpl-logger');
 
log('My first log');
log('My second log'); // The most recent log will appear first in logs.txt
  • Changing your log file (globally):
const logger = require('purpl-logger');
 
logger.path = 'logs/my-log-file';
logger.log('Logging to my-log-file');
 
logger.path = 'logs/my-other-log-file';
logger.log('Logging to my-other-log-file');
  • Specifying a log file to the log function:
const { log } = require('purpl-logger');
 
log('Logging to my-logs.txt', 'my-logs.txt');
log('Logging to logs/some-file.log', 'logs/some-file.log');

Package Sidebar

Install

npm i purpl-logger

Weekly Downloads

2

Version

1.0.6

License

MIT

Unpacked Size

4.72 kB

Total Files

5

Last publish

Collaborators

  • nayuwu