ok-log is a cute and handy global logging utility for JavaScript that enhances your console output with emojis and useful helpers β no need to import individual functions!
Just
import 'ok-log'once and uselog(),logError(),logSuccess()etc. anywhere globally.
- π
log(data)β Regularconsole.log - β
logSuccess(data)β Green success log - β
logError(error)β Error log with red alert β οΈ logWarn(warn)β Warning messages- βΉοΈ
logInfo(info)β Informational messages - π
logDebug(debug)β For debugging - π
logWithTime(data)β Log with current time - π
clearLog()β Clear console - π΄
sleep(ms)β Delay execution - π²
pickRandom(arr)β Pick a random element - π’
randomInt(min, max)β Generate random integer
npm install ok-logimport 'ok-log';
//or
const {} = require('ok-log')
log('Hello!');
logSuccess('Operation complete!');
logError('Something went wrong');
logWarn('This is a warning');
logInfo('Some info for you');
logDebug('Debugging now...');
logWithTime('This happened now');
await sleep(1000);
log(pickRandom(['π', 'π', 'π']));
log(randomInt(1, 100));Hello!
β
Operation complete!
β Something went wrong
β οΈ This is a warning
βΉοΈ Some info for you
π Debugging now...
π [14:32:01] This happened now
//sleep 1 sec
π //pickRandom (random fruit)
57 //randomInt (random number between 1 and 100)