Skip to content

Logging Module

Hoie Kim edited this page Apr 23, 2020 · 10 revisions

Intro

Instead of your typical console.log, we use a logging component.

How to use

  1. Logging module is in lib folder. Import lib/log.js

    Exmaple: const logger = require('./lib/log')

  2. Replace console.log to logger.info.

    Exmaple: logger.info('function has successfuly run')

  3. You can apply different levels according to its importance.

    Inportance Level Example
    0 Error logger.error('an error has occured')
    1 Warn `logger.warn('warning!')
    2 Info `logger.info('function has successfuly run')
    3 Verbose `logger.verbose('I don't even know what verbose means')
    4 Debug `logger.debug('debug message')
  4. Output

Clone this wiki locally