You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im looking for a way to get the formatted string that morgan would otherwise send to the console, so I can pass it and an object representing the data to my logger. Currently I am just building the object with tokens['token'] and using that object to build up a string to output, but it is rather ugly and hard to match the format that morgan outputs on its own.
The text was updated successfully, but these errors were encountered:
dougwilson
changed the title
[Question] Is there a way to get the formatted output string inside the format function?
Is there a way to get the formatted output string inside the format function?
May 6, 2015
Sorry, I didn't think to just link the code in question. I was currently messing around with creating a new instance of morgan inside the format function and passing in a fake next(), but that doesn't solve the problem because it still just writes to stdout. So I figured I would ask here in case there is a simple answer.
Closing, as the new morgan.compile should provide the necessary hook (and only requires a single eval at script start up, to boot). Example is over at the PR: #62 (comment)
Im looking for a way to get the formatted string that morgan would otherwise send to the console, so I can pass it and an object representing the data to my logger. Currently I am just building the object with tokens['token'] and using that object to build up a string to output, but it is rather ugly and hard to match the format that morgan outputs on its own.
The text was updated successfully, but these errors were encountered: