Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

how do I pass in arguments for connect logger?

how do I pass in arguments for connect logger?

Problem

This is a basic question but I'm not sure what the syntax is for passing in the stream option to the arguments in Connect Logger middleware.

http://senchalabs.github.com/connect/middleware-Logger.html

Is it?:

connect.logger('default', myLogger)

And if I wanted to log it to loggly, would I pass in the Loggly object? What interface would it have to implement?

Problem courtesy of: MonkeyBonkey

Solution

ok figured it out..

connect.logger(format: 'short', stream:Logger)

And in the Logger object implement a method called "write"

exports.write = (msg) ->
    process.stdout.write msg
Solution courtesy of: MonkeyBonkey

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

how do I pass in arguments for connect logger?

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×