Comparing version 2.12.4 to 2.13.0
{ | ||
"name": "pino", | ||
"version": "2.12.4", | ||
"version": "2.13.0", | ||
"description": "fast and simple logger", | ||
@@ -5,0 +5,0 @@ "main": "pino.js", |
19
pino.js
@@ -204,3 +204,8 @@ 'use strict' | ||
function fastRep (s) { | ||
// magically escape strings for json | ||
// relying on their charCodeAt | ||
// everything below 32 needs JSON.stringify() | ||
// 34 and 92 happens all the time, so we | ||
// have a fast case for them | ||
function escape (s) { | ||
var str = s.toString() | ||
@@ -210,5 +215,7 @@ var result = '' | ||
var l = str.length | ||
for (var i = 0; i < l; i++) { | ||
if (str[i] === '"') { | ||
result += str.slice(last, i) + '\\"' | ||
var point = 255 | ||
for (var i = 0; i < l && point >= 32; i++) { | ||
point = str.charCodeAt(i) | ||
if (point === 34 || point === 92) { | ||
result += str.slice(last, i) + '\\' + str[i] | ||
last = i + 1 | ||
@@ -222,3 +229,3 @@ } | ||
} | ||
return result | ||
return point < 32 ? JSON.stringify(str) : '"' + result + '"' | ||
} | ||
@@ -234,3 +241,3 @@ | ||
if (msg != undefined) { | ||
data += ',"msg":"' + fastRep(msg) + '"' | ||
data += ',"msg":' + escape(msg) | ||
} | ||
@@ -237,0 +244,0 @@ var value |
![banner](pino-banner.png) | ||
# pino [![Build Status](https://travis-ci.org/mcollina/pino.svg)](https://travis-ci.org/mcollina/pino) [![Coverage Status](https://coveralls.io/repos/github/mcollina/pino/badge.svg?branch=master)](https://coveralls.io/github/mcollina/pino?branch=master) [![TypeScript definitions on DefinitelyTyped](http://definitelytyped.org/badges/standard.svg)](http://definitelytyped.org) | ||
# pino [![Build Status](https://travis-ci.org/mcollina/pino.svg?branch=master)](https://travis-ci.org/mcollina/pino) [![Coverage Status](https://coveralls.io/repos/github/mcollina/pino/badge.svg?branch=master)](https://coveralls.io/github/mcollina/pino?branch=master) [![TypeScript definitions on DefinitelyTyped](http://definitelytyped.org/badges/standard.svg)](http://definitelytyped.org) | ||
@@ -411,3 +411,2 @@ [Extremely fast](#benchmarks) node.js logger, inspired by Bunyan. | ||
<a name="flush"></a> | ||
@@ -414,0 +413,0 @@ ### logger.flush() |
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
592548
32
2353
1037