Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Adding 'clear' as a module level function for use with defaultLogger #165

Merged
merged 2 commits into from

3 participants

@calvinfo

Pretty small change, I'd like to be able to 'clear' all the transports on the default logger. Seems like most of the code to do this is already there.

Let me know if there's anything I missed!

@travisbot

This pull request passes (merged 08ae171 into 8ecd17c).

@Marak Marak merged commit 3cae317 into winstonjs:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 6 deletions.
  1. +1 −0  lib/winston.js
  2. +6 −6 test/winston-test.js
View
1  lib/winston.js
@@ -71,6 +71,7 @@ var methods = [
'stream',
'add',
'remove',
+ 'clear',
'profile',
'startTimer',
'extend',
View
12 test/winston-test.js
@@ -13,7 +13,7 @@ var fs = require('fs'),
assert = require('assert'),
winston = require('../lib/winston'),
helpers = require('./helpers');
-
+
vows.describe('winston').addBatch({
"The winston module": {
topic: function () {
@@ -30,7 +30,7 @@ vows.describe('winston').addBatch({
assert.isObject(winston.default.transports.console);
assert.isFalse(winston.emitErrs);
assert.isObject(winston.config);
- ['Logger', 'add', 'remove', 'extend']
+ ['Logger', 'add', 'remove', 'extend', 'clear']
.concat(Object.keys(winston.config.npm.levels))
.forEach(function (key) {
assert.isFunction(winston[key]);
@@ -76,15 +76,15 @@ vows.describe('winston').addBatch({
assert.isObject(winston.default.transports.console);
assert.isFalse(winston.emitErrs);
assert.isObject(winston.config);
-
+
var newLevels = Object.keys(winston.config.syslog.levels);
- ['Logger', 'add', 'remove', 'extend']
+ ['Logger', 'add', 'remove', 'extend', 'clear']
.concat(newLevels)
.forEach(function (key) {
assert.isFunction(winston[key]);
});
-
-
+
+
Object.keys(winston.config.npm.levels)
.filter(function (key) {
return newLevels.indexOf(key) === -1;
Something went wrong with that request. Please try again.