Comparing version 0.2.3 to 0.2.4
@@ -29,3 +29,3 @@ 'use strict'; | ||
// filter `null` and `void 0` | ||
return v !== null; | ||
return v != null; | ||
} | ||
@@ -53,2 +53,4 @@ | ||
debug('There are ' + writables.length + ' writables for this logger'); | ||
var pre = '[' + prefix + ']'; | ||
@@ -94,2 +96,4 @@ // default timestamp format | ||
if (isDev() && !isDefined(logToConsole)) { | ||
debug('In dev mode and `logToConsole` is set to true.'); | ||
logToConsole = true; | ||
@@ -96,0 +100,0 @@ } |
{ | ||
"name": "elecpen", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "a simple logger", | ||
@@ -12,3 +12,3 @@ "main": "lib/index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/leozdgao/logger.git" | ||
"url": "git+https://github.com/leozdgao/elecpen.git" | ||
}, | ||
@@ -15,0 +15,0 @@ "keywords": [ |
@@ -1,23 +0,23 @@ | ||
var assert = require('assert') | ||
var fs = require('fs') | ||
var elecpen = require('../src') | ||
const assert = require('assert') | ||
const fs = require('fs') | ||
const elecpen = require('../src') | ||
describe('Test actions of the logger.', function() { | ||
var logger, logger2 | ||
describe('Test actions of the logger.', _ => { | ||
let logger, logger2 | ||
var infoFile = 'info.test.log' | ||
var opts = { | ||
infoFile: infoFile | ||
const infoFile = 'info.test.log' | ||
const opts = { | ||
infoFile | ||
} | ||
before(function() { | ||
before(function () { | ||
logger = elecpen.defaultLogger(opts) | ||
logger2 = elecpen.defaultLogger(opts) | ||
}) | ||
after(function(done) { | ||
after(function (done) { | ||
fs.unlink('info.test.log', done) | ||
}) | ||
it('Should create a file', function(done) { | ||
fs.exists(infoFile, function(exist) { | ||
it('Should create a file', done => { | ||
fs.exists(infoFile, exist => { | ||
assert.equal(exist, true) | ||
@@ -28,7 +28,7 @@ done() | ||
it('Should log correct entry.', function(done) { | ||
var expect = /^\[Info\] (.*?) Hello world(?:\n+|$)/m | ||
it('Should log correct entry.', done => { | ||
const expect = /^\[Info\] (.*?) Hello world(?:\n+|$)/m | ||
logger.info('Hello world') | ||
fs.readFile(infoFile, { encoding: 'utf-8' }, function(err, result) { | ||
var match = result.match(expect) | ||
fs.readFile(infoFile, { encoding: 'utf-8' }, (err, result) => { | ||
const match = result.match(expect) | ||
assert.notEqual(match, null) | ||
@@ -40,8 +40,8 @@ assert.equal(isNaN(Date.parse(match[1])), false) | ||
it('Should append to an existed file.', function(done) { | ||
it('Should append to an existed file.', done => { | ||
logger2.info('Hello world') | ||
logger2.info('Hello world') | ||
fs.readFile(infoFile, { encoding: 'utf-8' }, function(err, result) { | ||
var lines = result.split('\n') | ||
fs.readFile(infoFile, { encoding: 'utf-8' }, (err, result) => { | ||
const lines = result.split('\n') | ||
assert.equal(lines.length, 3) | ||
@@ -48,0 +48,0 @@ done(err) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11675
173