silly-logger
v1.3.1
Published
a logger library to make your console fancy
Downloads
36
Readme
Makes your Console look pretty!
Silly-logger is a small project of mine. It's useful to make your console look pretty with a great variety and customizability of logging functions. I'm actively working on the pack so expect to update the package more often in the starting time, tho major features are already in it, some minor ones will be added frequently.
Table of Contents
- Install
- Highlights
- Usage
- Customization
- Log to files
- Version explenation
Install
$ npm install silly-logger
Highlights
- Customizeable
- Simple to use
- Actively Maintained
Usage - Logging Simple Stuff
const logger = require('silly-logger');
// or
import * as logger from 'silly-logger';
// Logger presets
logger.info("Nice Information here");
logger.success("I'm up and running!");
logger.error("Oh no Some error happend here");
logger.crash("Fabulous Crashes (hopefully not)");
logger.warn("Warning! Something didn't work...");
logger.debug("I like Llamas");
logger.startup("Program starting");
logger.deploy("Deployed Command");
Custom Logger Message (Hex Code)
const logger = require('silly-logger');
//or
import * as logger from 'silly-logger';
// logger.custom('PREFIX', 'COLOR', 'TEXTCOLOR', "TEXT")
// Custom Logger Messages with hex code
logger.custom('WONDERFUL', '#ffffff', '#F5A9F2',"Some Message here");
logger.custom('LOL', '#F5A9F2', '#618FB1',"That's so funny");
logger.custom('DARLING', '#618FB1', '#ffffff',"A wunderful DC-Bot for everyone");
Custom Logger Message (Colors)
const logger = require('silly-logger');
//or
import * as logger from 'silly-logger';
// logger.custom('PREFIX', 'COLOR', 'TEXTCOLOR', "TEXT")
// Custom Logger Messages with color
logger.custom('red', 'red', 'red', "red");
logger.custom('orange', 'orange', 'orange',"orange");
logger.custom('gold', 'gold', 'gold', "gold");
logger.custom('yellow', 'yellow', 'yellow', "yellow");
logger.custom('green', 'green', 'green', "green");
logger.custom('dark_green', 'dark_green', 'dark_green', "dark_green");
logger.custom('teal', 'teal', 'teal', "teal");
logger.custom('cyan', 'cyan', 'cyan', "cyan");
logger.custom('light_blue', 'light_blue', 'light_blue', "light_blue");
logger.custom('blue', 'blue', 'blue', "blue");
logger.custom('dark_blue', 'dark_blue', 'dark_blue', "dark_blue");
logger.custom('blurple', 'blurple', 'blurple', "blurple");
logger.custom('purple', 'purple', 'purple', "purple");
logger.custom('fuchsia', 'fuchsia', 'fuchsia', "fuchsia");
logger.custom('magenta', 'magenta', 'magenta', "magenta");
logger.custom('dark_magenta', 'dark_magenta', 'dark_magenta', "dark_magenta");
timeFormat
const logger = require('silly-logger');
//or
import * as logger from 'silly-logger';
// logger.timeFormat('STRING');
// Change the Format of the Date globally (https://momentjs.com/)
logger.timeFormat('DD-MM-YYYY');
logger.info('Testing DD-MM-YYYY');
logger.timeFormat('h-mm-ss a');
logger.info('Testing h-mm-ss a');
logger.timeFormat("MMM Do YY - h:mm:ss a");
logger.info('Testing MMM Do YY - h:mm:ss a');
Log to files
Create a folder for your logs. Enable the function and set the path, BEFORE you use the logger!
const logger = require('silly-logger');
//or
import * as logger from 'silly-logger';
// logger.enableLogFiles(true/false);
logger.enableLogFiles(true);
// logger.logFolderPath('PATH');
logger.logFolderPath('./logs');
Version Explenation
Example Version: v1.2.3
1 = Project Stage Currently, no Plans for this Number.
2 = Major Update Major updates are Updates where the code majorly changes, so you as a consumer have to check the functionality of your program while using this package.
3 = Minor Update Minor updates just updates little stuff, so there are no necessary but nice to have. Here will be no changes for functions or else.