egg-logger
Advanced tools
Comparing version 1.4.0 to 1.4.1
1.4.1 / 2016-11-11 | ||
================== | ||
* refactor: use .close instead of .end (#12) | ||
* fix: print to stderr when stream closed (#11) | ||
1.4.0 / 2016-11-02 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -5,3 +5,5 @@ 'use strict'; | ||
const utils = require('./utils'); | ||
const depd = require('depd')('egg-logger'); | ||
/** | ||
@@ -121,8 +123,16 @@ * Base class for all sub Logger class. | ||
*/ | ||
end() { | ||
close() { | ||
for (const transport of this.values()) { | ||
transport.end(); | ||
transport.close(); | ||
} | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
end() { | ||
depd('logger.end() is deprecated, use logger.close()'); | ||
this.close(); | ||
} | ||
} | ||
@@ -129,0 +139,0 @@ |
'use strict'; | ||
const depd = require('depd')('egg-logger'); | ||
const FileTransport = require('./file'); | ||
@@ -35,8 +36,16 @@ const utils = require('../utils'); | ||
*/ | ||
end() { | ||
close() { | ||
this._closeInterval(); | ||
super.end(); | ||
super.close(); | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
end() { | ||
depd('transport.end() is deprecated, use transport.close()'); | ||
this.close(); | ||
} | ||
/** | ||
* 将内存中的字符写入文件中 | ||
@@ -43,0 +52,0 @@ */ |
@@ -8,2 +8,3 @@ 'use strict'; | ||
const utility = require('utility'); | ||
const depd = require('depd')('egg-logger'); | ||
const Transport = require('./transport'); | ||
@@ -57,3 +58,5 @@ const utils = require('../utils'); | ||
if (!this._stream) { | ||
throw new Error(this.options.file + ' log stream had been closed'); | ||
const err = new Error(`${this.options.file} log stream had been closed`); | ||
console.error(err.stack); | ||
return; | ||
} | ||
@@ -69,3 +72,3 @@ const buf = super.log(level, args, meta); | ||
*/ | ||
end() { | ||
close() { | ||
this._closeStream(); | ||
@@ -75,2 +78,10 @@ } | ||
/** | ||
* @deprecated | ||
*/ | ||
end() { | ||
depd('transport.end() is deprecated, use transport.close()'); | ||
this.close(); | ||
} | ||
/** | ||
* 直接写入 stream | ||
@@ -77,0 +88,0 @@ * @param {Buffer} buf - 日志内容 |
@@ -100,2 +100,3 @@ 'use strict'; | ||
*/ | ||
close() {} | ||
end() {} | ||
@@ -102,0 +103,0 @@ } |
{ | ||
"name": "egg-logger", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "egg logger", | ||
@@ -8,3 +8,4 @@ "main": "index.js", | ||
"chalk": "^1.1.3", | ||
"debug": "^2.2.0", | ||
"debug": "^2.3.2", | ||
"depd": "^1.1.0", | ||
"iconv-lite": "^0.4.13", | ||
@@ -15,6 +16,6 @@ "mkdirp": "^0.5.1", | ||
"devDependencies": { | ||
"beautify-benchmark": "*", | ||
"benchmark": "2", | ||
"co-sleep": "*", | ||
"coffee": "3", | ||
"autod": "^2.7.1", | ||
"beautify-benchmark": "^0.2.4", | ||
"benchmark": "^2.1.2", | ||
"coffee": "^3.3.0", | ||
"egg-bin": "^1.0.1", | ||
@@ -24,7 +25,8 @@ "egg-ci": "1", | ||
"eslint-config-egg": "3", | ||
"koa": "1", | ||
"mm": "1", | ||
"rimraf": "2", | ||
"should": "9", | ||
"supertest": "1", | ||
"ko-sleep": "^1.0.2", | ||
"koa": "^1.2.4", | ||
"mm": "^2.0.0", | ||
"rimraf": "^2.5.4", | ||
"should": "^11.1.1", | ||
"supertest": "^2.0.1", | ||
"supertest-as-promised": "3" | ||
@@ -39,2 +41,3 @@ }, | ||
"scripts": { | ||
"autod": "autod", | ||
"lint": "eslint lib test *.js", | ||
@@ -53,4 +56,4 @@ "test": "npm run lint && egg-bin test", | ||
"ci": { | ||
"version": "4, 6" | ||
"version": "4, 6, 7" | ||
} | ||
} |
@@ -84,3 +84,3 @@ # egg-logger | ||
```js | ||
logger.reload(); // will end the exists write stream and create a new one. | ||
logger.reload(); // will close the exists write stream and create a new one. | ||
``` | ||
@@ -87,0 +87,0 @@ |
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
32563
931
6
15
+ Addeddepd@^1.1.0
+ Addeddepd@1.1.2(transitive)
Updateddebug@^2.3.2