Comparing version 0.9.8 to 0.9.9
"use strict"; | ||
var logger = require('..').console(); | ||
var logger = require('tracer').console(); | ||
logger.log('hello'); | ||
@@ -4,0 +4,0 @@ logger.trace('hello', 'world'); |
@@ -9,3 +9,3 @@ { | ||
}, | ||
"version": "0.9.8", | ||
"version": "0.9.9", | ||
"author": "LI Long <lilong@gmail.com>", | ||
@@ -17,2 +17,3 @@ "license": "MIT", | ||
"mkdirp": "^0.5.1", | ||
"nyc": "^14.1.1", | ||
"tinytim": "0.1.1" | ||
@@ -22,9 +23,8 @@ }, | ||
"cli-color": "^1.4.0", | ||
"dtslint": "^0.4.2", | ||
"eslint": "^5.11.1", | ||
"expresso": "^0.9.2", | ||
"istanbul": "^0.4.5", | ||
"dtslint": "^0.4.9", | ||
"eslint": "^5.16.0", | ||
"mocha": "^6.2.0", | ||
"mongoskin": "2.1.0", | ||
"tslint": "^5.12.0", | ||
"typescript": "^3.2.2" | ||
"tslint": "^5.18.0", | ||
"typescript": "^3.5.3" | ||
}, | ||
@@ -40,7 +40,7 @@ "main": "./lib/index", | ||
"scripts": { | ||
"test": "expresso test/*", | ||
"test": "mocha test/*", | ||
"lint:fix": "eslint --fix .", | ||
"lint": "eslint .", | ||
"posttest": "npm run lint", | ||
"test:coverage": "istanbul cover expresso test/*.js", | ||
"test:coverage": "nyc npm run test", | ||
"posttest:coverage": "npm run lint", | ||
@@ -47,0 +47,0 @@ "dtslint": "dtslint types" |
@@ -492,2 +492,7 @@ # tracer for node.js | ||
### 0.9.9 | ||
* Fixed. Port tests from expresso to mocha. Fixes #105 #106 by @ossdev07. | ||
* Fixed. Update type definitions to be able to use array in filters. #104 by @irisked. | ||
* Fixed potential security vulnerabilities in your dependencies in istanbul package. | ||
### 0.9.8 | ||
@@ -494,0 +499,0 @@ * Added. {{folder}} template option for parent folder. #96 by @shbatm. |
123
test/test.js
"use strict"; | ||
var assert = require("assert"); | ||
exports["simple"] = function() { | ||
describe('simple', function() { | ||
var logger = require('../').console({ | ||
@@ -12,2 +12,3 @@ transport : function(data) { | ||
var o = logger.info('hello'); | ||
it("simple logger", function () { | ||
assert.equal(o['message'], 'hello'); | ||
@@ -17,5 +18,6 @@ assert.equal(o['file'], 'test.js'); | ||
assert.equal(o['level'], 3); | ||
} | ||
}); | ||
}); | ||
exports["stack index"] = function() { | ||
describe('stack index', function() { | ||
var logger = require('../').console({ | ||
@@ -32,8 +34,10 @@ stackIndex: 1, | ||
var o = logMgr('info', 'hello'); | ||
it("stack index", function () { | ||
assert.equal(o['message'], 'hello'); | ||
assert.equal(o['file'], 'test.js'); | ||
assert.equal(o['line'], 29); | ||
} | ||
assert.equal(o['line'], 31); | ||
}); | ||
}); | ||
exports["simple message"] = function() { | ||
describe('simple message' , function() { | ||
var logger = require('../').console({ | ||
@@ -47,6 +51,8 @@ format : "{{message}}", | ||
var o = logger.log('hello'); | ||
it("simple message", function () { | ||
assert.equal(o['output'], 'hello'); | ||
} | ||
}); | ||
}); | ||
exports["inspect depth"] = function() { | ||
describe("inspect depth", function() { | ||
var logger = require('../').console({ | ||
@@ -72,6 +78,8 @@ format : "{{message}}", | ||
}); | ||
it("inspect depth", function () { | ||
assert.equal(o['output'], "{ i1: 'value', i2: { i21: 'val21', i22: [Object] } }"); | ||
} | ||
}); | ||
}); | ||
exports["simple color message"] = function() { | ||
describe("simple color message", function() { | ||
var logger = require('../').colorConsole({ | ||
@@ -85,6 +93,8 @@ format : "{{message}}", | ||
var o = logger.debug('hello'); | ||
it("simple color message", function () { | ||
assert.equal(o.output, '\u001b[36mhello\u001b[39m'); | ||
} | ||
}); | ||
}); | ||
exports["console log method"] = function() { | ||
describe('console log method' , function() { | ||
var logger = require('../').console({ | ||
@@ -98,8 +108,10 @@ format : "{{message}}", | ||
var o = logger.log('hello %s %d %j %t', 'world', 123, {j:'val'}, {t:'val'}); | ||
it("console log method", function () { | ||
assert.equal(o['title'], 'log'); | ||
assert.equal(o['file'], '');//the format don't include "file", so can't get it | ||
assert.equal(o['output'], 'hello world 123 {"j":"val"} { t: \'val\' }'); | ||
} | ||
}); | ||
}); | ||
exports["custom format"] = function() { | ||
describe("custom format", function() { | ||
var logger = require('../').console({ | ||
@@ -118,2 +130,3 @@ format : [ | ||
}); | ||
it("custom format", function () { | ||
var o = logger.log('hello %s %d', 'world', 123); | ||
@@ -125,5 +138,6 @@ assert.equal(o['output'], 'hello world 123'); | ||
assert.equal(o['output'], 'error:hello world 123'); | ||
} | ||
}); | ||
}); | ||
exports["custom filter"] = function() { | ||
describe("custom filter", function() { | ||
var colors = require('colors'); | ||
@@ -150,2 +164,3 @@ var logger = require('../').console({ | ||
var o = logger.log('hello %s %d', 'world', 123); | ||
it("custom filter", function () { | ||
assert.equal(o['output'], '\u001b[4mhello world 123\u001b[24m'); | ||
@@ -159,5 +174,6 @@ assert.equal(o['level'], 0); | ||
assert.equal(o['level'], 5); | ||
} | ||
}); | ||
}); | ||
exports["set level to log"] = function() { | ||
describe("set level to log", function() { | ||
var logger = require('../').console({level:'log', | ||
@@ -168,2 +184,3 @@ transport : function(data) { | ||
}); | ||
it("set level to log", function () { | ||
assert.ok(logger.log('hello')); | ||
@@ -175,4 +192,5 @@ assert.ok(logger.trace('hello', 'world')); | ||
assert.ok(logger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object)); | ||
} | ||
exports["set level to 0"] = function() { | ||
}); | ||
}); | ||
describe("set level to 0", function() { | ||
var logger = require('../').console({level:0, | ||
@@ -183,2 +201,3 @@ transport : function(data) { | ||
}); | ||
it("set level to 0", function () { | ||
assert.ok(logger.log('hello')); | ||
@@ -190,4 +209,5 @@ assert.ok(logger.trace('hello', 'world')); | ||
assert.ok(logger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object)); | ||
} | ||
exports["set level to 2"] = function() { | ||
}); | ||
}); | ||
describe("set level to 2", function() { | ||
var logger = require('../').console({level:2, | ||
@@ -198,2 +218,3 @@ transport : function(data) { | ||
}); | ||
it("set level to 2", function () { | ||
assert.ok(!logger.log('hello')); | ||
@@ -205,4 +226,5 @@ assert.ok(!logger.trace('hello', 'world')); | ||
assert.ok(logger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object)); | ||
} | ||
exports["set level to warn"] = function() { | ||
}); | ||
}); | ||
describe("set level to warn", function() { | ||
var logger = require('../').console({level:'warn', | ||
@@ -213,2 +235,3 @@ transport : function(data) { | ||
}); | ||
it("set level to warn", function () { | ||
assert.ok(!logger.log('hello')); | ||
@@ -220,4 +243,5 @@ assert.ok(!logger.trace('hello', 'world')); | ||
assert.ok(logger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object)); | ||
} | ||
exports["set level to error"] = function() { | ||
}); | ||
}); | ||
describe("set level to error", function() { | ||
var logger = require('../').console({level:'error', | ||
@@ -228,2 +252,3 @@ transport : function(data) { | ||
}); | ||
it("set level to error", function () { | ||
assert.ok(!logger.log('hello')); | ||
@@ -235,4 +260,5 @@ assert.ok(!logger.trace('hello', 'world')); | ||
assert.ok(logger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object)); | ||
} | ||
exports["set level to max value"] = function() { | ||
}); | ||
}); | ||
describe("set level to max value", function() { | ||
var logger = require('../').console({level:Number.MAX_VALUE, | ||
@@ -243,2 +269,3 @@ transport : function(data) { | ||
}); | ||
it("set level to max value", function () { | ||
assert.ok(!logger.log('hello')); | ||
@@ -250,5 +277,6 @@ assert.ok(!logger.trace('hello', 'world')); | ||
assert.ok(!logger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object)); | ||
} | ||
}); | ||
}); | ||
exports["loop"] = function() { | ||
describe("loop", function() { | ||
var logger = require('../').console({ | ||
@@ -260,2 +288,3 @@ transport : function(data) { | ||
}); | ||
it("loop", function () { | ||
for(var i=0; i<100; i++){ | ||
@@ -265,8 +294,9 @@ var o = logger.info('hello'); | ||
assert.equal(o['file'], 'test.js'); | ||
assert.equal(o['line'], 238); | ||
assert.equal(o['line'], 267); | ||
assert.equal(o['level'], 3); | ||
} | ||
} | ||
}); | ||
}); | ||
exports["setLevel 1"] = function() { | ||
describe("setLevel 1", function() { | ||
var logger = require('../').console({ | ||
@@ -278,2 +308,3 @@ transport : function(data) { | ||
}); | ||
it("setLevel 1", function () { | ||
require('../').setLevel(2); | ||
@@ -286,6 +317,6 @@ assert.ok(!logger.log('hello')); | ||
assert.ok(logger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object)); | ||
}); | ||
}); | ||
} | ||
exports["setLevel 2"] = function() { | ||
describe("setLevel 2", function() { | ||
var logger = require('../').console({ | ||
@@ -297,2 +328,3 @@ transport : function(data) { | ||
}); | ||
it("setLevel 2", function () { | ||
require('../').setLevel('debug'); | ||
@@ -305,6 +337,6 @@ assert.ok(!logger.log('hello')); | ||
assert.ok(logger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object)); | ||
}); | ||
}); | ||
} | ||
exports["close"] = function() { | ||
describe("close", function() { | ||
var logger = require('../').console({ | ||
@@ -316,2 +348,3 @@ transport : function(data) { | ||
}); | ||
it("close", function () { | ||
require('../').close(); | ||
@@ -325,13 +358,15 @@ assert.ok(!logger.log('hello')); | ||
assert.ok(!logger.fatal('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object, logger)); | ||
}); | ||
}); | ||
} | ||
exports["simple"] = function() { | ||
describe("simple", function() { | ||
var logger = require('../').console(); | ||
var o = logger.log('hello'); | ||
it("recheck simple", function () { | ||
assert.equal(o['message'], 'hello'); | ||
assert.equal(o['file'], 'test.js'); | ||
assert.equal(o['line'], 300); | ||
assert.equal(o['line'], 333); | ||
assert.equal(o['level'], 0); | ||
} | ||
}); | ||
}); | ||
@@ -103,3 +103,3 @@ // TypeScript Version: 2.6 | ||
dateformat?: string; | ||
filters?: FilterFunction[] | LevelOption<FilterFunction> | Array<FilterFunction | LevelOption<FilterFunction | FilterFunction[]>>; | ||
filters?: FilterFunction[] | LevelOption<FilterFunction | FilterFunction[]> | Array<FilterFunction | LevelOption<FilterFunction | FilterFunction[]>>; | ||
/** | ||
@@ -106,0 +106,0 @@ * Output the log, if level of log larger than or equal to `level`. |
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
73586
7
1625
676
5
54
+ Addednyc@^14.1.1
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/generator@7.26.2(transitive)
+ Added@babel/helper-string-parser@7.25.9(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@babel/parser@7.26.2(transitive)
+ Added@babel/template@7.25.9(transitive)
+ Added@babel/traverse@7.25.9(transitive)
+ Added@babel/types@7.26.0(transitive)
+ Added@jridgewell/gen-mapping@0.3.5(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Addedansi-regex@4.1.1(transitive)
+ Addedansi-styles@3.2.1(transitive)
+ Addedappend-transform@1.0.0(transitive)
+ Addedarchy@1.0.0(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcaching-transform@3.0.2(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedcliui@5.0.0(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedcommondir@1.0.1(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconvert-source-map@1.9.0(transitive)
+ Addedcp-file@6.2.0(transitive)
+ Addedcross-spawn@4.0.2(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addeddefault-require-extensions@2.0.0(transitive)
+ Addedemoji-regex@7.0.3(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedes6-error@4.1.1(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedfind-cache-dir@2.1.0(transitive)
+ Addedfind-up@3.0.0(transitive)
+ Addedforeground-child@1.5.6(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglobals@11.12.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedhasha@3.0.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedhtml-escaper@2.0.2(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-fullwidth-code-point@2.0.0(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedistanbul-lib-coverage@2.0.5(transitive)
+ Addedistanbul-lib-hook@2.0.7(transitive)
+ Addedistanbul-lib-instrument@3.3.0(transitive)
+ Addedistanbul-lib-report@2.0.8(transitive)
+ Addedistanbul-lib-source-maps@3.0.6(transitive)
+ Addedistanbul-reports@2.2.7(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedjsesc@3.0.2(transitive)
+ Addedjson-parse-better-errors@1.0.2(transitive)
+ Addedload-json-file@4.0.0(transitive)
+ Addedlocate-path@3.0.0(transitive)
+ Addedlodash.flattendeep@4.4.0(transitive)
+ Addedlru-cache@4.1.5(transitive)
+ Addedmake-dir@2.1.0(transitive)
+ Addedmerge-source-map@1.1.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedms@2.1.3(transitive)
+ Addednested-error-stacks@2.1.1(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addednyc@14.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@3.0.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpackage-hash@3.0.0(transitive)
+ Addedparse-json@4.0.0(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@3.0.0(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpify@3.0.04.0.1(transitive)
+ Addedpkg-dir@3.0.0(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedread-pkg@3.0.0(transitive)
+ Addedread-pkg-up@4.0.0(transitive)
+ Addedrelease-zalgo@1.0.0(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedrequire-main-filename@2.0.0(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedresolve-from@4.0.0(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsemver@5.7.26.3.1(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedspawn-wrap@1.4.3(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.20(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedstring-width@3.1.0(transitive)
+ Addedstrip-ansi@5.2.0(transitive)
+ Addedstrip-bom@3.0.0(transitive)
+ Addedsupports-color@6.1.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtest-exclude@5.2.3(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedwrap-ansi@5.1.0(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedwrite-file-atomic@2.4.3(transitive)
+ Addedy18n@4.0.3(transitive)
+ Addedyallist@2.1.2(transitive)
+ Addedyargs@13.3.2(transitive)
+ Addedyargs-parser@13.1.2(transitive)