1.0.68 • Published 5 years ago

@flavioespinoza/log_log v1.0.68

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

log_log

Color logs for node console

Info

This ES Module uses the new esm module loader by John-David Dalton

See the release post and video for all the details.

Install

yarn (recommended)

yarn add @flavioespinoza/log_log

npm

npm i @flavioespinoza/log_log

ES6 import

Use import in typescript or using the new esm loader

// esm or typescript
import _log, { log } from '@flavioespinoza/log_log'

ES5 require

Use require for 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 Object or Array with nested Objects

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 _log with 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 _log with 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 _log with 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 log without the underscore log.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 _log with 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

1.0.68

5 years ago

1.0.67

5 years ago

1.0.66

5 years ago

1.0.65

5 years ago

1.0.64

5 years ago

1.0.63

5 years ago

1.0.62

5 years ago

1.0.61

5 years ago

1.0.59

5 years ago

1.0.58

5 years ago

1.0.57

5 years ago

1.0.56

5 years ago

1.0.55

5 years ago

1.0.54

5 years ago

1.0.53

5 years ago

1.0.52

5 years ago

1.0.51

5 years ago

1.0.50

5 years ago

1.0.49

5 years ago

1.0.48

5 years ago

1.0.47

5 years ago

1.0.46

5 years ago

1.0.45

5 years ago

1.0.44

5 years ago

1.0.43

5 years ago

1.0.42

5 years ago

1.0.41

5 years ago

1.0.40

5 years ago

1.0.39

5 years ago

1.0.38

5 years ago

1.0.37

5 years ago

1.0.36

5 years ago

1.0.35

5 years ago

1.0.34

5 years ago

1.0.33

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago