Comparing version 0.1.0 to 0.1.1-beta-1
@@ -8,2 +8,7 @@ # GoLog Changelog | ||
## [v0.1.1] - 2019-09-26 | ||
### Fixed | ||
- `error` event to not throw an exception when not handled | ||
## [v0.1.0] - 2019-09-25 | ||
@@ -13,1 +18,2 @@ - First officially published version. | ||
[v0.1.0]: https://gitlab.com/GCSBOSS/golog/-/tags/v0.1.0 | ||
[v0.1.1]: https://gitlab.com/GCSBOSS/golog/-/tags/v0.1.1 |
@@ -13,3 +13,3 @@ const { EventEmitter } = require('events'); | ||
message: err.message, | ||
stack: err.stack.split(/[\r\n]+\s*/g).slice(1) | ||
stack: err.stack.split(/[\r\n]+\s*/g).slice(1, -1) | ||
}; | ||
@@ -81,2 +81,3 @@ } | ||
super(); | ||
this.on('error', Function.prototype); | ||
this.active = true; | ||
@@ -108,3 +109,3 @@ this.streams = {}; | ||
addFile(name, file, level) { | ||
let stream = fs.createWriteStream(file); | ||
let stream = fs.createWriteStream(file, { flags: 'a' }); | ||
this.addStream(name, stream, level); | ||
@@ -111,0 +112,0 @@ } |
{ | ||
"name": "golog", | ||
"version": "0.1.0", | ||
"version": "0.1.1-beta-1", | ||
"description": "A light-weight heavily inspired logging library", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -0,0 +0,0 @@ # [GoLog](https://gitlab.com/GCSBOSS/golog) |
const MemoryStream = require('memorystream'); | ||
const Tempper = require('tempper'); | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
@@ -193,1 +194,29 @@ const Logger = require('../lib/main'); | ||
}); | ||
describe('Regression', function(){ | ||
beforeEach(function(){ | ||
log = new Logger(); | ||
log.addStream('mem', stream); | ||
}); | ||
it('Should not throw exception when error event not handled', function(){ | ||
log.error('bar'); | ||
}); | ||
it('Should always append to files', function(done){ | ||
let tmp = new Tempper(); | ||
fs.writeFileSync('./test', 'abc'); | ||
log = new Logger({ file: './test' }); | ||
log.mode = 'minimal'; | ||
log.warn('hey'); | ||
log.streams.main.stream.end(); | ||
setTimeout(function(){ | ||
let data = fs.readFileSync('./test'); | ||
assert(/^abc.*\- warn \- hey/g.test(data.toString())); | ||
tmp.clear(); | ||
done(); | ||
}, 1200); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
18795
268
2