XLBlogger
Basic and simple node.js logger with #ConsoleColoration
Why
I wrote xlblogger because i needed a simple way to follow the execution and debug my nodejs scripts.
Installation
npm install xlblogger
Example
var xlblogger = ;var logger = 'Alpha''C:/XLBlogger'; logger; // Default Coloration var FgMagenta = '\x1b[35m'; // Magenta font color Codelogger; logger;logger; logger;logger; // output Objectsvar data = {}dataid = 21220244datavalue = 22772020dataname = 'Marou'datapwd = '*******'dataemail = 'test@xlblogger.npm' logger
PS: All the proposed functions works with strings as well as objects.
Features
First thing's first:
var xlblogger = ;
❁ Easy and simple configuration:
• Specify the output directories:
The parent dir is optional :
- You can specify it globally in 'logConfig.xml' , in this case every instance of xlblogger will have a subdirectory in the specified parent dir.
- You can keep the default value (C:/XLBlogger)
NOTE : (the xml file is generated after the first execution, in the same folder of your js file)
/* var logger = new xlblogger( [outputDir] , <parentDir> ) */var logger = 'Alpha''C:/XLBlogger';// orvar logger = 'Alpha'; // Default parent dir
XLBlogger
│
└───Alpha
│ Alpha.[04].Of.16h51.[03].log
│ Alpha.[04].Of.16h59.[53].log
• Start logging: Time for you to go.
logger; // The logger is active by default
• Stop logging: The goal of the "Stop" instruction is to provide the option of disabling the logger without commenting or deleting our messages.
logger;
❤ Foreground and Background console colors:
Save attribute : value in the log file and show the message in the console.
logger;
Save an empty line, help you improve the readability of your logs.
logger;
Save the message and show it in the console with an optional color.
logger; var FgMagenta = '\x1b[35m';logger;
Save the message and show it in the console.
logger;
Save three value and show them in the console with different colors.
logger;
This feature was added to offer a simple way to export Brut data to a file
var xlblogger = ; var out = 'testOut''C:/XLBlogger'; out;
Color code examples:
/* ColorList */ /* ################################# */ Reset = "\x1b[0m" Bright = "\x1b[1m" Dim = "\x1b[2m" Underscore = "\x1b[4m" Blink = "\x1b[5m" Reverse = "\x1b[7m" Hidden = "\x1b[8m" FgBlack = "\x1b[30m" FgRed = "\x1b[31m" FgGreen = "\x1b[32m" FgYellow = "\x1b[33m" FgBlue = "\x1b[34m" FgMagenta = "\x1b[35m" FgCyan = "\x1b[36m" FgWhite = "\x1b[37m" BgBlack = "\x1b[40m" BgRed = "\x1b[41m" BgGreen = "\x1b[42m" BgYellow = "\x1b[43m" BgBlue = "\x1b[44m" BgMagenta = "\x1b[45m" BgCyan = "\x1b[46m" BgWhite = "\x1b[47m" /* ################################# */
Screenshots
❤ Foreground and Background console colors:
ϟ Log every execution separately:
License
(The MIT License)