JSPM

  • Created
  • Published
  • Downloads 71631
  • Score
    100M100P100Q147209F
  • License BSD

Key-Value log line parser

Package Exports

  • logfmt

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (logfmt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-logfmt

use

straight up

var logfmt = require('logfmt'),

logfmt.parse("foo=bar a=14 baz=\"hello kitty\" cool%story=bro f %^asdf")
//=>{ "foo": "bar", "a": 14, "baz": "hello kitty", "cool%story": "bro", "f": true, "%^asdf": true }

express middleware

var logfmt   = require('logfmt-body-parser');

app.use(logfmt());

// req.body is now an array of objects

command line

echo "foo=bar a=14 baz=\"hello kitty\" cool%story=bro f %^asdf" | logfmt
{ "foo": "bar", "a": 14, "baz": "hello kitty", "cool%story": "bro", "f": true, "%^asdf": true }