node-lancer
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -32,3 +32,3 @@ 'use strict'; | ||
this.level = null == options.level ? Logger.config.level : options.level; | ||
this.disabled = options.disabled; | ||
this.isDebug = options.debug; | ||
this.stdout = options.stdout || Logger.config.stdout || process.stdout; | ||
@@ -108,3 +108,17 @@ this.stderr = options.stderr || Logger.config.stderr || process.stderr; | ||
} | ||
if (this.disabled) {return;} | ||
if (this.isDebug) { | ||
var DEBUG = String(process.env.DEBUG || ""); | ||
if (DEBUG === "" || DEBUG.toLowerCase() === 'false') { | ||
DEBUG = false; | ||
} else if (DEBUG.toLowerCase() === 'true' || DEBUG === '*') { | ||
DEBUG = true; | ||
} else if (typeof DEBUG === 'string') { | ||
DEBUG = DEBUG.indexOf(namespace.split(/[\:\.]/)[0]) === 0; | ||
} else { | ||
DEBUG = false; | ||
} | ||
if (!DEBUG) { | ||
return; | ||
} | ||
} | ||
if (this._groupMsg) { | ||
@@ -291,15 +305,3 @@ return this._groupMsg.push({stream:type,line:msg}); | ||
opts.name = Logger.helper.IFELSE(Logger.helper.color(namespace,'*'), ':',''); | ||
var DEBUG = String(process.env.DEBUG || ""); | ||
if (DEBUG === "" || DEBUG.toLowerCase() === 'false') { | ||
DEBUG = false; | ||
} else if (DEBUG.toLowerCase() === 'true' || DEBUG === '*') { | ||
DEBUG = true; | ||
} else if (typeof DEBUG === 'string') { | ||
DEBUG = DEBUG.indexOf(namespace.split(/[\:\.]/)[0]) === 0; | ||
} else { | ||
DEBUG = false; | ||
} | ||
if (null == opts.disabled) { | ||
opts.disabled = !DEBUG; | ||
} | ||
opts.isDebug = true; | ||
var _debug = new Logger(opts); | ||
@@ -306,0 +308,0 @@ function debug() { |
{ | ||
"name": "node-lancer", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "An node logger for colorful with line info supported.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
31981
735