@flavioespinoza/log_log v1.0.68
log_log
Color logs for node console
Info
This ES Module uses the new esm module loader by John-David Dalton
Install
yarn (recommended)
yarn add @flavioespinoza/log_lognpm
npm i @flavioespinoza/log_logES6 import
Use
importin typescript or using the new esm loader
// esm or typescript
import _log, { log } from '@flavioespinoza/log_log'ES5 require
Use
requirefor common.js modules// require const _log = require('@flavioespinoza/log_log') const { log } = require('@flavioespinoza/log_log')
Deep (Nested Objects)
Show the entire depth of a nested
ObjectorArraywith nestedObjects
const data = [
{
name: 'Ren',
id: 1,
preferences: {
food: 'steak',
drink: 'bourbon',
ice_cream: 'soap bar',
favorite_episode: 'Space Madness',
hobbies: {
sports: ['soccer', 'bad mitten'],
dancing: ['salsa', 'bachata'],
music: {
alternative: ['Pearl Jam', 'Nirvana'],
glam_rock: ['Mötley Crüe', 'Poison'],
country: ['Johnny Cash', 'George Strait']
}
}
}
}
]
_log.deep(data) //=> See console output below..._log.deep(data)
Use
_logwith the underscore_log.deep(data)to show the complete data structure no matter how deep the nested object is
console.log(data)
Normal
console.log(data)does not show nested data past 2 levels deep
Alerts
Use
_logwith the underscore_log.alertName(data)to show different levels of priority
_log.info(data)_log.error(data)_log.alert(data)_log.warn(data)Background Colors
Use
_logwith the underscore_log.colorName(data)to show data with background color
_log.blue(data)_log.red(data)_log.green(data)_log.pink(data)_log.yellow(data)_log.violet(data)_log.cyan(data)Text Colors
Use
logwithout the underscorelog.colorName(data)to color text with no background.
log.blue(data)log.red(data)log.green(data)log.yellow(data)log.cyan(data)log.magenta(data)log.black(data)Timer
Use
_logwith the underscore_log.timer(method, methodName)to show how long a function takes to return.
function do_stuff() {
let res = []
for (let i = 0; i < 100000; i++) {
res.push(i)
}
return res
}
_log.timer(do_stuff, 'Do Stuff')console output
Licence: MIT
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago