From dc8d04e8e0fe6bdc599f644e8d5b07eb8de62b3a Mon Sep 17 00:00:00 2001 From: Mark Cavage Date: Tue, 22 Nov 2011 13:36:08 -0800 Subject: [PATCH] Don't require log4js in bin/* --- bin/ldapjs-add | 3 ++- bin/ldapjs-compare | 3 ++- bin/ldapjs-delete | 3 ++- bin/ldapjs-modify | 3 ++- bin/ldapjs-search | 3 ++- lib/log_stub.js | 9 +++++++++ 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bin/ldapjs-add b/bin/ldapjs-add index 82e7eb5..ebd1507 100755 --- a/bin/ldapjs-add +++ b/bin/ldapjs-add @@ -6,7 +6,6 @@ var fs = require('fs'); var path = require('path'); var url = require('url'); -var log4js = require('log4js'); var nopt = require('nopt'); var ldap = require('../lib/index'); @@ -15,6 +14,8 @@ var ldap = require('../lib/index'); ///--- Globals +var log4js = ldap.log4js; + nopt.typeDefs.DN = { type: ldap.DN, validate: function(data, k, val) { diff --git a/bin/ldapjs-compare b/bin/ldapjs-compare index 767f87a..9a961f1 100755 --- a/bin/ldapjs-compare +++ b/bin/ldapjs-compare @@ -6,7 +6,6 @@ var fs = require('fs'); var path = require('path'); var url = require('url'); -var log4js = require('log4js'); var nopt = require('nopt'); var ldap = require('../lib/index'); @@ -15,6 +14,8 @@ var ldap = require('../lib/index'); ///--- Globals +var log4js = ldap.log4js; + nopt.typeDefs.DN = { type: ldap.DN, validate: function(data, k, val) { diff --git a/bin/ldapjs-delete b/bin/ldapjs-delete index 2ea187e..d5afa70 100755 --- a/bin/ldapjs-delete +++ b/bin/ldapjs-delete @@ -6,7 +6,6 @@ var fs = require('fs'); var path = require('path'); var url = require('url'); -var log4js = require('log4js'); var nopt = require('nopt'); var ldap = require('../lib/index'); @@ -15,6 +14,8 @@ var ldap = require('../lib/index'); ///--- Globals +var log4js = ldap.log4js; + nopt.typeDefs.DN = { type: ldap.DN, validate: function(data, k, val) { diff --git a/bin/ldapjs-modify b/bin/ldapjs-modify index 2e7ddea..cca7338 100755 --- a/bin/ldapjs-modify +++ b/bin/ldapjs-modify @@ -6,7 +6,6 @@ var fs = require('fs'); var path = require('path'); var url = require('url'); -var log4js = require('log4js'); var nopt = require('nopt'); var ldap = require('../lib/index'); @@ -15,6 +14,8 @@ var ldap = require('../lib/index'); ///--- Globals +var log4js = ldap.log4js; + nopt.typeDefs.DN = { type: ldap.DN, validate: function(data, k, val) { diff --git a/bin/ldapjs-search b/bin/ldapjs-search index b326083..e615100 100755 --- a/bin/ldapjs-search +++ b/bin/ldapjs-search @@ -5,7 +5,6 @@ var path = require('path'); var url = require('url'); -var log4js = require('log4js'); var nopt = require('nopt'); var ldap = require('../lib/index'); @@ -14,6 +13,8 @@ var ldap = require('../lib/index'); ///--- Globals +var log4js = ldap.log4js; + nopt.typeDefs.DN = { type: ldap.DN, validate: function(data, k, val) { diff --git a/lib/log_stub.js b/lib/log_stub.js index 4f6079e..6579113 100644 --- a/lib/log_stub.js +++ b/lib/log_stub.js @@ -130,6 +130,7 @@ Log.prototype.fatal = function() { module.exports = { setLevel: function(l) { + l = l.charAt(0).toUpperCase() + l.slice(1).toLowerCase(); if (LEVELS[l] !== undefined) level = l; @@ -141,6 +142,14 @@ module.exports = { throw new TypeError('name (string) required'); return new Log(name); + }, + + setGlobalLogLevel: function(l) { + l = l.charAt(0).toUpperCase() + l.slice(1).toLowerCase(); + if (LEVELS[l] !== undefined) + level = l; + + return level; } };