Skip to content

Raycas96/pretty-logger

Repository files navigation

Pretty-Logger 🚀

Language: TypeScript Version NPM

Pretty-logger is a light and simple alternative to console.log. It allows you to console Warning, Error ed Info with a unique styles.

Install

You can install it through the npm packet manager typing

npm i @raycas/pretty-logger --save-dev

Usage

It is very simple to use and you can use it with vanilla JavaScript or with Framework like Angular or a library like React.

new Logger(isProduction: boolean)

It allows you to instantiate a new istance of the Logger class and define if it is production mode or not. If isProduction is setted to true no log will show.

import { Logger } from '@raycas/pretty-logger';

const logger = new Logger(false);
logger.info('Hello', { world: 'test' }, 'lorem'); //[ℹINFO]: [Hello] { world: 'test' } [lorem]
logger.error('Hello', { world: 'test' }, 'lorem'); //[☠ERROR]: [Hello] { world: 'test' } [lorem]
logger.warn('Hello', { world: 'test' }, 'lorem'); //[⚠WARN]: [Hello] { world: 'test' } [lorem]

logger(...items: any) ⚡

It Allows you to console the items without istantiate the Logger class

import { logger } from '@raycas/pretty-logger';

logger.info('Hello', { world: 'test' }, 'lorem'); //[ℹINFO]: [Hello] { world: 'test' } [lorem]
logger.error('Hello', { world: 'test' }, 'lorem'); //[☠ERROR]: [Hello] { world: 'test' } [lorem]
logger.warn('Hello', { world: 'test' }, 'lorem'); //[⚠WARN]: [Hello] { world: 'test' } [lorem]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published