logoligi

1.0.1 • Public • Published

logoligi

Ties chalk, boxen & ora behind a simple logging api. Wrapps around console.log. This allows you to do the following;

Usage

import Logger from 'logoligi';

// start logging 
Logger.log('Hi');

// log with config
Logger.log('Hello', {
   color: 'blue', // https://github.com/chalk/chalk/tree/main#colors
   bgColor: 'white', // https://github.com/chalk/chalk/tree/main#background-colors
   box: 'double' // https://github.com/sindresorhus/boxen/tree/main#borderstyle
});

// full config interface
/*
interface LoggerConfigI {
  color?: string;
  bgColor?: string;
  box?: string;
  title?: string;
  status?: "warn" | "success" | "fail" | "info" | "end"; // only for Logger.endLog ...
}
*/

// default configs for different log levels have been set
Logger.info('H');
Logger.debug('E');
Logger.warn('LL');
Logger.error('O');

// you can pass config for each of these
Logger.info('Okay!', {
   color: 'yello'
});

// show loader whilst asyn process is running
const logger = Logger.startLog('Downloading ...');
await new Promise(r => setTimeout(r, 2000));
Logger.endLog(logger, 'Finished Downloading!');
Logger.endLog(logger, 'Finished Downloading!', { status: 'success' }); // indicate success check mark in console
// indicate failure
Logger.endLog(logger, 'failed Downloading!', { status: 'fail' }); 
// you can indicate error, info, and warning as well.

Package Sidebar

Install

npm i logoligi

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

10.9 kB

Total Files

8

Last publish

Collaborators

  • baahkusi