Skip to content

purplnay/logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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');

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published