Socket
Socket
Sign inDemoInstall

strong-log-transformer

Package Overview
Dependencies
Maintainers
17
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strong-log-transformer - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

14

CHANGES.md

@@ -0,1 +1,15 @@

2018-12-14, Version 2.1.0
=========================
* src: replace byline with custom splitter (Ryan Graham)
* test: add color tag tests (Ryan Graham)
* test: ensure test fixtures use consistent newlines (Ryan Graham)
* test: replicate shell tests in JS (Ryan Graham)
* test: add tests for truncated utf8 sequences (Ryan Graham)
2018-08-11, Version 2.0.0

@@ -2,0 +16,0 @@ =========================

34

lib/logger.js

@@ -12,5 +12,5 @@ // Copyright IBM Corp. 2014,2018. All Rights Reserved.

var byline = require('byline');
var through = require('through');
var duplexer = require('duplexer');
var StringDecoder = require('string_decoder').StringDecoder;

@@ -34,3 +34,3 @@ module.exports = Logger;

options = util._extend(defaults, options || {});
var catcher = new byline.LineStream;
var catcher = deLiner();
var emitter = catcher;

@@ -61,3 +61,3 @@ var transforms = [

// restore line endings that were removed by byline
// restore line endings that were removed by line splitting
transforms.push(reLiner());

@@ -72,2 +72,30 @@

function deLiner() {
var decoder = new StringDecoder('utf8');
var last = '';
return new stream.Transform({
transform(chunk, _enc, callback) {
last += decoder.write(chunk);
var list = last.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g);
last = list.pop();
for (var i = 0; i < list.length; i++) {
// swallow empty lines
if (list[i]) {
this.push(list[i]);
}
}
callback();
},
flush(callback) {
// incomplete UTF8 sequences become UTF8 replacement characters
last += decoder.end();
if (last) {
this.push(last);
}
callback();
},
});
}
function reLiner() {

@@ -74,0 +102,0 @@ return through(appendNewline);

3

package.json
{
"name": "strong-log-transformer",
"version": "2.0.0",
"version": "2.1.0",
"description": "Stream transformer that prefixes lines with timestamps and other things.",

@@ -30,3 +30,2 @@ "author": "Ryan Graham <ryan@strongloop.com>",

"dependencies": {
"byline": "^5.0.0",
"duplexer": "^0.1.1",

@@ -33,0 +32,0 @@ "minimist": "^1.2.0",

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