js-pretty-logger 🎨
A Simple beaultiful to read console logger
Usage
First off all, you need to set the localStorage
key showConsole
.
This was made to avoid some users of seeing these infos into console by default.
localStorage;
Then just import and use:
// CommonJSconst logger = ;; //ES6;;
11:53:08 AuthGuard • Initialized
Options
param | type | description |
---|---|---|
title | string | The context that will be logged. Just for visual. |
message | string | The message that will be logged.. Just for visual too |
options (optional) | object | object with log configurations |
options.type | string | type of message that will be logged. Defines what is the title color. Options: default, danger, info, success or warn |
options.isDetailed | boolean | Show the log time with detailed information. Good when you need to let yout application running from one day to another |
Examples
All color options
;;;;;
Detailed time
;
Pro-tip 💡
Create methods inside yout code to abstract params:
// socket_middleware.js;// create a method to abstract title and typeconst logIntoConsole = {;}// then use in yout code!const onConnect = {;}const onError = {;}