Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

golog

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

golog - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1-beta-1

6

CHANGELOG.md

@@ -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

5

lib/main.js

@@ -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 @@ }

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc