UNPKG

546 BJavaScriptView Raw
1"use strict";
2
3var log = require('loglevel');
4var inArray = require('in-array');
5
6var utilsApi = {};
7
8/**
9 * Set the internal log level and return a log module instance
10 * @param {Object} options Command line options e.g silent, verbose
11 * @return {Object} Log module instance
12 */
13utilsApi.getLogInstance = function(options) {
14 if(options.silent) {
15 log.setLevel(log.levels.SILENT);
16 } else if(options.verbose) {
17 log.setLevel(log.levels.TRACE);
18 } else {
19 log.setLevel(log.levels.INFO);
20 }
21
22 return log;
23}
24
25module.exports = utilsApi;
\No newline at end of file