-
Notifications
You must be signed in to change notification settings - Fork 11
Logging Module
Hoie Kim edited this page Apr 23, 2020
·
10 revisions
Instead of your typical console.log
, we use a logging component.
-
Logging module is in
lib
folder. Importlib/log.js
and pass__filename
in as an argument.- Exmaple:
const logger = require('./lib/log')(__filename)
- Exmaple:
-
Replace
console.log
tologger.info
.- Exmaple:
logger.info('function has successfully run')
- Exmaple:
-
You can add logger with any information you want to log and 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 successfully run')