By default winston uses the following levels:
var levels = {
silly: 0,
verbose: 1,
info: 2,
warn: 3,
var async = require('async'), | |
forever = require('forever'); | |
function startApp (options, next){ | |
var child = new (forever.Monitor) (script, { | |
'options': [ | |
'--port', options.port, | |
'--secret', options.secret, | |
'--userSchema', options.userSchema | |
] |
Implications for EventEmitter2 and .pipe()
APIs
I have been working on refactoring [node-cloudfiles][0] to use @mikeal's [request][1] library for HTTPS uploads now that they are more stable. The current [pull-request][2] makes use of the continue
event which it seems is not handled by the default .pipe()
handler (for good reason). The work around potentially supporting this in [request][1] has made me revisit the need for EventEmitter2 with some new arguments that I find more compelling that those which were laid out before, that is: Selective Piping.
Suppose that you wish to pipe arbitrary events from one stream to another, but only those which are relevant to your concerns. For example, if you were piping an http.ClientReqest
stream to an http.ClientResponse
stream you may wish to only pipe those events relevant to the http
module (i.e. ignore those events from net.Stream
).
If we were to use EventEmitter2, we could namespace these events u
var http = require('http'), | |
static = require('node-static'), | |
qs = require('querystring'), | |
winston = require('winston'), | |
MongoDB = require('winston-mongodb').MongoDB, | |
url = require('url'); | |
var file = new(static.Server)('./public'); | |
winston.use(MongoDB, { |
mkdir sandbox | |
curl https://gist.github.com/gists/1159290/download -o node-sandbox.tgz | |
tar zxvf node-sandbox.tgz | |
mv gist1159290*/* sandbox/ | |
rm -rf gist1159290* | |
cd sandbox |
$ ab -c 100 -n 10000 http://127.0.0.1:8000/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking 127.0.0.1 (be patient) | |
Completed 1000 requests | |
Completed 2000 requests | |
Completed 3000 requests | |
Completed 4000 requests |
// This example adapted from Matt Gallagher's "Minimalist Cocoa Programming" | |
// blog article: | |
// http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html | |
var $ = require('NodObjC') | |
$.import('Cocoa') | |
var pool = $.NSAutoreleasePool('alloc')('init') | |
, app = $.NSApplication('sharedApplication') |
Exec { | |
path => [ | |
'/usr/local/bin', | |
'/usr/local/sbin', | |
'/usr/bin/', | |
'/usr/sbin', | |
'/bin', | |
'/sbin'], | |
logoutput => true, | |
} |
---------- Forwarded message ---------- | |
From: Mark S. Miller <[email protected]> | |
Date: Tue, Nov 16, 2010 at 3:44 PM | |
Subject: "Future of Javascript" doc from our internal "JavaScript Summit" | |
last week | |
To: [email protected] | |
On November 10th and 11th, a number of Google teams representing a variety | |
of viewpoints on client-side languages met to agree on a common vision for | |
the future of Javascript. |
function hasOwnProperty(key) { | |
if(this[key]) { | |
var proto = this.prototype; | |
if(proto) { | |
return ((key in this.prototype) && (this[key] === this.prototype[key])); | |
} | |
return true; | |
} else { | |
return false; | |
} |