lelog v1.0.1
LELOG - lelog
A dual-environment logger that automatically switches between server and client logging.
- Supports Typescript.
Installation
npm i lelog
or
npm install lelog
Usage
Usage 1 (Only import and use with default class name (lelog))
// Use directly
import lelog from 'lelog';
lelog.info('Hello World');
lelog.info('Hello World', true); // true bool adds timestamp output to log.
Usage 2 (Import and init with custom class name (can be direct class name or string))
// custom instance with different class name
import { lelog } from 'lelog';
const lelog = lelog('MyCustomClass');
lelog.info('Custom logger message');
lelog.info('Custom logger message', true); // true bool adds timestamp output to log.
lelog types:
Standard logging with multi-color
lelog.info('Standart info log 🚀🚀🚀');
lelog.warn('Standart warning log');
lelog.error('Standart error log');
Custom colored message usages:
lelog.logColored('Custom colored log message', { message: '#8e44ad', className: '#F5eead' });
Background colored log message usage:
lelog.logWithBackground('Log message with background', '#2ecc71');
Gradient message usage:
lelog.logGradient('Gradient colored log message 01234567890123456789012345678901234567890');
Boxed message usage:
lelog.logBox('Info log in a box', '#2ecc71');
Log group usage:
lelog.logGroup('Log group message', { action: 'click', element: 'button', });
Showcase & Usage examples:
(browser console)
(nodejs - middleware.ts - terminal)
(with time bool true (that bool is optional if not entered "false" will be default))
7 months ago