Comparing version 0.14.0 to 0.14.1
@@ -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"'} |
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
50408
1165