97 lines
13 KiB
JSON
97 lines
13 KiB
JSON
|
{
|
||
|
"_args": [
|
||
|
[
|
||
|
{
|
||
|
"raw": "logfmt@^1.2.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "logfmt",
|
||
|
"name": "logfmt",
|
||
|
"rawSpec": "^1.2.0",
|
||
|
"spec": ">=1.2.0 <2.0.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/@expo/ngrok"
|
||
|
]
|
||
|
],
|
||
|
"_from": "logfmt@>=1.2.0 <2.0.0",
|
||
|
"_id": "logfmt@1.2.0",
|
||
|
"_inCache": true,
|
||
|
"_location": "/logfmt",
|
||
|
"_npmUser": {
|
||
|
"name": "csquared",
|
||
|
"email": "christopher.continanza@gmail.com"
|
||
|
},
|
||
|
"_npmVersion": "1.4.3",
|
||
|
"_phantomChildren": {
|
||
|
"through": "2.3.8"
|
||
|
},
|
||
|
"_requested": {
|
||
|
"raw": "logfmt@^1.2.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "logfmt",
|
||
|
"name": "logfmt",
|
||
|
"rawSpec": "^1.2.0",
|
||
|
"spec": ">=1.2.0 <2.0.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"_requiredBy": [
|
||
|
"/@expo/ngrok"
|
||
|
],
|
||
|
"_resolved": "https://registry.npmjs.org/logfmt/-/logfmt-1.2.0.tgz",
|
||
|
"_shasum": "1ccc067c1cfe65f3ecf5856c09d2654f69203572",
|
||
|
"_shrinkwrap": null,
|
||
|
"_spec": "logfmt@^1.2.0",
|
||
|
"_where": "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/@expo/ngrok",
|
||
|
"author": {
|
||
|
"name": "csquared"
|
||
|
},
|
||
|
"bin": {
|
||
|
"logfmt": "./bin/logfmt"
|
||
|
},
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/csquared/node-logfmt/issues"
|
||
|
},
|
||
|
"dependencies": {
|
||
|
"lodash": "~2.4.1",
|
||
|
"split": "0.2.x",
|
||
|
"through": "2.3.x"
|
||
|
},
|
||
|
"description": "key=value logger and parser",
|
||
|
"devDependencies": {
|
||
|
"express": "3.3.x",
|
||
|
"mocha": "*",
|
||
|
"restify": "*"
|
||
|
},
|
||
|
"directories": {},
|
||
|
"dist": {
|
||
|
"shasum": "1ccc067c1cfe65f3ecf5856c09d2654f69203572",
|
||
|
"tarball": "https://registry.npmjs.org/logfmt/-/logfmt-1.2.0.tgz"
|
||
|
},
|
||
|
"homepage": "https://github.com/csquared/node-logfmt#readme",
|
||
|
"keywords": [
|
||
|
"log",
|
||
|
"parser",
|
||
|
"logfmt"
|
||
|
],
|
||
|
"license": "MIT",
|
||
|
"main": "logfmt.js",
|
||
|
"maintainers": [
|
||
|
{
|
||
|
"name": "csquared",
|
||
|
"email": "christopher.continanza@gmail.com"
|
||
|
}
|
||
|
],
|
||
|
"name": "logfmt",
|
||
|
"optionalDependencies": {},
|
||
|
"readme": "# node-logfmt\n\n[![Build Status](https://travis-ci.org/csquared/node-logfmt.png)](https://travis-ci.org/csquared/node-logfmt)\n\n\n\"logfmt\" is the name for a [key value logging convention](https://github.com/kr/logfmt) we've adopted at Heroku.\n\nThis library is for both converting lines in logfmt format to objects and\nfor logging objects to a stream in logfmt format.\n\nIt provides a logfmt parser, logfmt stringifier, a logging facility,\nand both streaming and non-streaming body parsers for express and restify.\n\nYou should use this library if you're trying to write structured logs or\nif you're consuming them (especially if you're writing a logplex drain).\n\n## install\n\n npm install logfmt\n\n# use\n\n## node.js\n\nThe `logfmt` module is a singleton that works directly from require.\n\n```javascript\nvar logfmt = require('logfmt');\n\nlogfmt.stringify({foo: 'bar'});\n// 'foo=bar'\n\nlogfmt.parse('foo=bar');\n// {foo: 'bar'}\n```\n\nIt is also a constructor function, so you can use `new logfmt` to create\na new `logfmt` that you can configure differently.\n\n```javascript\nvar logfmt2 = new logfmt;\n\n// replace our stringify with JSON's\nlogfmt2.stringify = JSON.stringify\n\n// now we log JSON!\nlogfmt2.log({foo: 'bar'})\n// {\"foo\":\"bar\"}\n\n// and the original logfmt is untouched\nlogfmt.log({foo: 'bar'})\n// foo=bar\n```\n\n## command line\n\n### logfmt\n\naccepts lines on STDIN and converts them to json\n\n\n > echo \"foo=bar a=14 baz=\\\"hello kitty\\\" cool%story=bro f %^asdf\" | logfmt\n { \"foo\": \"bar\", \"a\": 14, \"baz\": \"hello kitty\", \"cool%story\": \"bro\", \"f\": true, \"%^asdf\": true }\n\n### logfmt -r (reverse)\n\naccepts JSON on STDIN and converts them to logfmt\n\n > echo '{ \"foo\": \"bar\", \"a\": 14, \"baz\": \"hello kitty\", \\\n \"cool%story\": \"bro\", \"f\": true, \"%^asdf\": true }' | logfmt -r\n foo=bar a=14 baz=\"hello kitty\" cool%story=bro f=true %^asdf=true\n\nround trips for free!\n\n > echo \"foo=bar a=14 baz=\\\"hello kitty\\\" cool%story=bro f %^asdf\" | logfmt | logfmt -r | logfmt\n { \"foo\": \"bar\", \"a\": 14, \"baz\": \"hello kitty\", \"cool%story\": \"bro\", \"f\": true, \"%^asdf\": true }\n\n\n# API\n\n## stringifying\n\nSerialize an object to logfmt format\n\n### `logfmt.stringify(object)`\n\nSerializes a single object.\n\n```javascript\nlogfmt.stringify({foo: \"bar\", a: 14, baz: 'hello kitty'})\n//> 'foo=bar a=14 baz=\"hello kitty\"'\n```\n\n## parsing\n\nParse a line in logfmt format\n\n### `logfmt.parse(string)`\n\n```javascript\nlogfmt.parse(\"foo=bar a=14 baz=\\\"hello kitty\\\" cool%story=bro f %^asdf code=H12\")\n//> { \"foo\": \"bar\", \"a\": '14', \"baz\": \"hello kitty\", \"cool%story\": \"bro\", \"f\": true, \"%^asdf\": true, \"code\" : \"H12\" }\n```\n\nThe only conversions are from the strings `true` and `false` to their proper boolean counterparts.\n\nWe cannot arbitrarily convert numbers because that will drop precision for numbers that require more than 32 bits to represent them.\n\n\n## Streaming\n\nPut this in your pipe and smoke it.\n\n### `logfmt.streamParser()`\n\nCreates a streaming parser that will automatically split and parse incoming lines and\nemit javascript objects.\n\nStream in from STDIN\n\n```javascript\nprocess.stdin.pipe(logfmt.streamParser())\n```\n\nOr pipe from an HTTP request\n\n```javascript\nreq.pipe(logfmt.streamParser())\n```\n\n### `logfmt.streamStringify([options])`\n\nPipe objects into the stream and it will write logfmt.\nYou can customize the delimiter via the `options` object, which\ndefaults to `\\n` (newlines).\n\n```javascript\n var parseJSON = function(line) {\n if(!line) return;\n this.queue(JSON.parse(line.trim()))\n }\n\n process.stdin\n .pipe(split())\n .pipe(through(parseJSON))\n .pipe(logfmt.streamStringify())\n .pipe(process.stdout)\n```\n\n#### Example\n\n\nExample command line of parsing logfmt and echoing objects to STDOUT:\n\n```javascript\nvar logfmt = require('logfmt');\nvar through = require('through');\n\nprocess.stdin\n .pipe(logfm
|
||
|
"readmeFilename": "README.md",
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "git+https://github.com/csquared/node-logfmt.git"
|
||
|
},
|
||
|
"scripts": {
|
||
|
"test": "mocha"
|
||
|
},
|
||
|
"version": "1.2.0"
|
||
|
}
|