more linting
This commit is contained in:
parent
3d11cbc0ad
commit
2cd27e4293
@ -1,85 +1,86 @@
|
|||||||
var vows = require('vows'),
|
"use strict";
|
||||||
assert = require('assert');
|
var vows = require('vows')
|
||||||
|
, assert = require('assert');
|
||||||
|
|
||||||
vows.describe('log4js global loglevel').addBatch({
|
vows.describe('log4js global loglevel').addBatch({
|
||||||
'global loglevel' : {
|
'global loglevel' : {
|
||||||
topic: function() {
|
topic: function() {
|
||||||
var log4js = require('../lib/log4js');
|
var log4js = require('../lib/log4js');
|
||||||
return log4js;
|
return log4js;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'set global loglevel on creation': function(log4js) {
|
||||||
|
var log1 = log4js.getLogger('log1');
|
||||||
|
var level = 'OFF';
|
||||||
|
if (log1.level.toString() == level) {
|
||||||
|
level = 'TRACE';
|
||||||
|
}
|
||||||
|
assert.notEqual(log1.level.toString(), level);
|
||||||
|
|
||||||
|
log4js.setGlobalLogLevel(level);
|
||||||
|
assert.equal(log1.level.toString(), level);
|
||||||
|
|
||||||
'set global loglevel on creation': function(log4js) {
|
var log2 = log4js.getLogger('log2');
|
||||||
var log1 = log4js.getLogger('log1');
|
assert.equal(log2.level.toString(), level);
|
||||||
var level = 'OFF';
|
},
|
||||||
if (log1.level.toString() == level) {
|
|
||||||
level = 'TRACE';
|
'global change loglevel': function(log4js) {
|
||||||
}
|
var log1 = log4js.getLogger('log1');
|
||||||
assert.notEqual(log1.level.toString(), level);
|
var log2 = log4js.getLogger('log2');
|
||||||
|
var level = 'OFF';
|
||||||
|
if (log1.level.toString() == level) {
|
||||||
|
level = 'TRACE';
|
||||||
|
}
|
||||||
|
assert.notEqual(log1.level.toString(), level);
|
||||||
|
|
||||||
|
log4js.setGlobalLogLevel(level);
|
||||||
|
assert.equal(log1.level.toString(), level);
|
||||||
|
assert.equal(log2.level.toString(), level);
|
||||||
|
},
|
||||||
|
|
||||||
log4js.setGlobalLogLevel(level);
|
'override loglevel': function(log4js) {
|
||||||
assert.equal(log1.level.toString(), level);
|
var log1 = log4js.getLogger('log1');
|
||||||
|
var log2 = log4js.getLogger('log2');
|
||||||
var log2 = log4js.getLogger('log2');
|
var level = 'OFF';
|
||||||
assert.equal(log2.level.toString(), level);
|
if (log1.level.toString() == level) {
|
||||||
},
|
level = 'TRACE';
|
||||||
|
}
|
||||||
'global change loglevel': function(log4js) {
|
assert.notEqual(log1.level.toString(), level);
|
||||||
var log1 = log4js.getLogger('log1');
|
|
||||||
var log2 = log4js.getLogger('log2');
|
var oldLevel = log1.level.toString();
|
||||||
var level = 'OFF';
|
assert.equal(log2.level.toString(), oldLevel);
|
||||||
if (log1.level.toString() == level) {
|
|
||||||
level = 'TRACE';
|
log2.setLevel(level);
|
||||||
}
|
assert.equal(log1.level.toString(), oldLevel);
|
||||||
assert.notEqual(log1.level.toString(), level);
|
assert.equal(log2.level.toString(), level);
|
||||||
|
assert.notEqual(oldLevel, level);
|
||||||
log4js.setGlobalLogLevel(level);
|
|
||||||
assert.equal(log1.level.toString(), level);
|
log2.removeLevel();
|
||||||
assert.equal(log2.level.toString(), level);
|
assert.equal(log1.level.toString(), oldLevel);
|
||||||
},
|
assert.equal(log2.level.toString(), oldLevel);
|
||||||
|
},
|
||||||
'override loglevel': function(log4js) {
|
|
||||||
var log1 = log4js.getLogger('log1');
|
'preload loglevel': function(log4js) {
|
||||||
var log2 = log4js.getLogger('log2');
|
var log1 = log4js.getLogger('log1');
|
||||||
var level = 'OFF';
|
var level = 'OFF';
|
||||||
if (log1.level.toString() == level) {
|
if (log1.level.toString() == level) {
|
||||||
level = 'TRACE';
|
level = 'TRACE';
|
||||||
}
|
}
|
||||||
assert.notEqual(log1.level.toString(), level);
|
assert.notEqual(log1.level.toString(), level);
|
||||||
|
|
||||||
var oldLevel = log1.level.toString();
|
var oldLevel = log1.level.toString();
|
||||||
assert.equal(log2.level.toString(), oldLevel);
|
log4js.getLogger('log2').setLevel(level);
|
||||||
|
|
||||||
log2.setLevel(level);
|
assert.equal(log1.level.toString(), oldLevel);
|
||||||
assert.equal(log1.level.toString(), oldLevel);
|
|
||||||
assert.equal(log2.level.toString(), level);
|
// get again same logger but as different variable
|
||||||
assert.notEqual(oldLevel, level);
|
var log2 = log4js.getLogger('log2');
|
||||||
|
assert.equal(log2.level.toString(), level);
|
||||||
log2.removeLevel();
|
assert.notEqual(oldLevel, level);
|
||||||
assert.equal(log1.level.toString(), oldLevel);
|
|
||||||
assert.equal(log2.level.toString(), oldLevel);
|
log2.removeLevel();
|
||||||
},
|
assert.equal(log1.level.toString(), oldLevel);
|
||||||
|
assert.equal(log2.level.toString(), oldLevel);
|
||||||
'preload loglevel': function(log4js) {
|
|
||||||
var log1 = log4js.getLogger('log1');
|
|
||||||
var level = 'OFF';
|
|
||||||
if (log1.level.toString() == level) {
|
|
||||||
level = 'TRACE';
|
|
||||||
}
|
|
||||||
assert.notEqual(log1.level.toString(), level);
|
|
||||||
|
|
||||||
var oldLevel = log1.level.toString();
|
|
||||||
log4js.getLogger('log2').setLevel(level);
|
|
||||||
|
|
||||||
assert.equal(log1.level.toString(), oldLevel);
|
|
||||||
|
|
||||||
// get again same logger but as different variable
|
|
||||||
var log2 = log4js.getLogger('log2');
|
|
||||||
assert.equal(log2.level.toString(), level);
|
|
||||||
assert.notEqual(oldLevel, level);
|
|
||||||
|
|
||||||
log2.removeLevel();
|
|
||||||
assert.equal(log1.level.toString(), oldLevel);
|
|
||||||
assert.equal(log2.level.toString(), oldLevel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).export(module);
|
}).export(module);
|
||||||
|
Loading…
Reference in New Issue
Block a user