egg-logger
Advanced tools
Comparing version 1.7.1 to 2.0.0
2.0.0 / 2018-10-08 | ||
================== | ||
**fixes** | ||
* [[`0296646`](http://github.com/eggjs/egg-logger/commit/0296646f1dd9f39925ed7e353cc22879ac851a1f)] - fix: don't write when stream is not writable (#30) (Yiyu He <<dead_horse@qq.com>>) | ||
**others** | ||
* [[`07f3635`](http://github.com/eggjs/egg-logger/commit/07f3635dc05574a926a222b48e4b6d5ec97453e0)] - deps: pin circular-json@0.5.5, update dependencies (#29) (Yiyu He <<dead_horse@qq.com>>) | ||
1.7.1 / 2018-07-09 | ||
@@ -3,0 +12,0 @@ ================== |
@@ -55,3 +55,3 @@ 'use strict'; | ||
flush() { | ||
if (this._buf.length > 0) { | ||
if (this._buf.length > 0 && this.writable) { | ||
if (this.options.encoding === 'utf8') { | ||
@@ -58,0 +58,0 @@ this._stream.write(this._buf.join('')); |
@@ -56,3 +56,3 @@ 'use strict'; | ||
log(level, args, meta) { | ||
if (!this._stream) { | ||
if (!this.writable) { | ||
const err = new Error(`${this.options.file} log stream had been closed`); | ||
@@ -93,2 +93,10 @@ console.error(err.stack); | ||
/** | ||
* transport is writable | ||
* @return {Boolean} writable | ||
*/ | ||
get writable() { | ||
return this._stream && !this._stream.closed && this._stream.writable && !this._stream.destroyed; | ||
} | ||
/** | ||
* 创建一个 stream | ||
@@ -108,3 +116,4 @@ * @return {Stream} 返回一个 writeStream | ||
}; | ||
stream.on('error', onError); | ||
// only listen error once because stream will reload after error | ||
stream.once('error', onError); | ||
stream._onError = onError; | ||
@@ -111,0 +120,0 @@ return stream; |
{ | ||
"name": "egg-logger", | ||
"version": "1.7.1", | ||
"version": "2.0.0", | ||
"description": "egg logger", | ||
"main": "index.js", | ||
"dependencies": { | ||
"chalk": "^1.1.3", | ||
"circular-json": "^0.5.4", | ||
"debug": "^2.6.2", | ||
"depd": "^1.1.0", | ||
"iconv-lite": "^0.4.15", | ||
"chalk": "^2.4.1", | ||
"circular-json": "0.5.5", | ||
"debug": "^2.6.9", | ||
"depd": "^1.1.2", | ||
"iconv-lite": "^0.4.24", | ||
"mkdirp": "^0.5.1", | ||
"utility": "^1.11.0" | ||
"utility": "^1.15.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^10.3.4", | ||
"autod": "^2.7.1", | ||
"autod": "^3.0.1", | ||
"beautify-benchmark": "^0.2.4", | ||
"benchmark": "^2.1.3", | ||
"coffee": "^3.3.0", | ||
"egg-bin": "^1.10.3", | ||
"egg-ci": "^1.5.0", | ||
"eslint": "^3.17.1", | ||
"eslint-config-egg": "^3.2.0", | ||
"benchmark": "^2.1.4", | ||
"coffee": "^5.1.0", | ||
"egg-bin": "^1.11.1", | ||
"egg-ci": "^1.8.0", | ||
"eslint": "^5.6.0", | ||
"eslint-config-egg": "^7.1.0", | ||
"heapdump": "^0.3.9", | ||
"ko-sleep": "^1.0.2", | ||
"koa": "^1.3.0", | ||
"mm": "^2.1.0", | ||
"mz-modules": "^2.0.0", | ||
"rimraf": "^2.6.1", | ||
"should": "^11.2.1", | ||
"supertest": "^3.0.0", | ||
"ts-node": "^6.0.5", | ||
"ko-sleep": "^1.0.3", | ||
"koa": "^1.6.2", | ||
"mm": "^2.4.1", | ||
"mz-modules": "^2.1.0", | ||
"rimraf": "^2.6.2", | ||
"should": "^13.2.3", | ||
"supertest": "^3.3.0", | ||
"ts-node": "^7.0.1", | ||
"typescript": "^2.8.3" | ||
@@ -59,3 +59,3 @@ }, | ||
"ci": { | ||
"version": "4, 6, 8, 9", | ||
"version": "6, 8, 10", | ||
"license": true | ||
@@ -62,0 +62,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
43947
1162
+ Addedansi-styles@3.2.1(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcircular-json@0.5.5(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedsupports-color@5.5.0(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedchalk@1.1.3(transitive)
- Removedcircular-json@0.5.9(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
Updatedchalk@^2.4.1
Updatedcircular-json@0.5.5
Updateddebug@^2.6.9
Updateddepd@^1.1.2
Updatediconv-lite@^0.4.24
Updatedutility@^1.15.0