aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGregg Caines <[email protected]>2013-12-05 21:39:48 -0800
committerGregg Caines <[email protected]>2013-12-05 21:39:48 -0800
commit92e0e4ef10feda6486703d6d2ca98ae64655733e (patch)
tree43e4a2777fa2dfb2d8d77f2c32e9c408c6ad9074 /lib
parentbe9cf789b3db0158b8364a48475e5671d45f16e8 (diff)
parent8bf0bf952cba404d3c0b49f22783cf49ba1dbb8f (diff)
downloadnode-coveralls-92e0e4ef10feda6486703d6d2ca98ae64655733e.tar.xz
node-coveralls-92e0e4ef10feda6486703d6d2ca98ae64655733e.zip
Merge pull request #28 from mattjmorrison/debug_setting
Added ability to turn on debug logging via environment variable
Diffstat (limited to 'lib')
-rw-r--r--lib/logger.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/logger.js b/lib/logger.js
index 985b67b..30a6c60 100644
--- a/lib/logger.js
+++ b/lib/logger.js
@@ -1,8 +1,18 @@
module.exports = function(){
- if (process.argv[2]) {
- if (~['-v', '--verbose'].indexOf(process.argv[2])) {
- return require('log-driver')({level : 'debug'});
- }
- }
- return require('log-driver')({level : 'warn'});
+ return require('log-driver')({level : getLogLevel()});
};
+
+function getLogLevel(){
+ if (hasVerboseCommandLineOption() || hasDebugEnvVariable()) {
+ return 'debug';
+ }
+ return 'warn';
+}
+
+function hasVerboseCommandLineOption(){
+ return process.argv[2] && ~['-v', '--verbose'].indexOf(process.argv[2]);
+}
+
+function hasDebugEnvVariable(){
+ return process.env.NODE_COVERALLS_DEBUG == 1;
+}