Socket
Socket
Sign inDemoInstall

logfmt

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logfmt - npm Package Compare versions

Comparing version 0.14.0 to 0.14.1

2

lib/logfmt_parser.js

@@ -40,3 +40,3 @@ exports.debug = false;

if(line[i] == '='){
if(line[i] == '=' && !in_quote){
if(debug) console.log('split')

@@ -43,0 +43,0 @@ //split

@@ -16,3 +16,3 @@ logfmt = require('../logfmt');

var needs_quoting = value.indexOf(' ') > -1;
var needs_quoting = value.indexOf(' ') > -1 || value.indexOf('=') > -1;
var needs_escaping = value.indexOf('"') > -1;

@@ -19,0 +19,0 @@

{
"name": "logfmt",
"version": "0.14.0",
"version": "0.14.1",
"description": "Key-Value log line parser",

@@ -5,0 +5,0 @@ "main": "logfmt.js",

@@ -26,2 +26,8 @@ var logfmt = require('../logfmt'),

test("quotes strings with equals in them", function(){
var data = {foo: "hello=kitty"}
logfmt.log(data, mock_sink);
assert.equal("foo=\"hello=kitty\"\n", mock_sink.logline)
})
test("escapes quotes within strings with spaces in them", function(){

@@ -28,0 +34,0 @@ var data = {foo: 'hello my "friend"'}

@@ -35,2 +35,6 @@ var logfmt = require('../logfmt'),

test("string with equals", function(){
assert.deepEqual({foo:"hello=kitty"}, logfmt.parse('foo="hello=kitty"'));
})
test("readme string parses", function(){

@@ -37,0 +41,0 @@ var test_string = "foo=bar a=14 baz=\"hello kitty\" "

@@ -20,3 +20,3 @@ var logfmt = require('../logfmt'),

test("quoted strings are restored", function(){
test("quoted strings with spaces are restored", function(){
var data = {foo: "hello kitty"}

@@ -27,2 +27,8 @@ logfmt.log(data, mock_sink);

test("quoted strings with equals are restored", function(){
var data = {foo: "hello=kitty"}
logfmt.log(data, mock_sink);
assert.deepEqual(data, logfmt.parse(mock_sink.logline))
})
test("escaped strings are restored", function(){

@@ -29,0 +35,0 @@ var data = {foo: 'hello my "friend"'}

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