question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding support of log middleware (similar to rewriters) that supports promises

See original GitHub issue

Please tell us about your environment:

  • winston version?
    • winston@2
    • winston@3
  • node -v outputs: 10.5.0
  • Operating System? macOS Sierra
  • Language? ES6/7

What’s the feature?

Adding support to add data to the log befora actually logging it (on the transport level). For example, if I use 2 transport - Console and Loggly - the console logs might be plain showing just the log message sent to it but I might want to add some additional information to the logs being sent to Loggly. I can create an async function to retreive the stack trace (using a package like stacktrace-js) and append it to the json being sent to Loggly.

This is just one example I believe it could help with.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
indexzerocommented, Jun 26, 2018

This is exactly what formats are for, but you are correct they are synchronous. Adding async support for formats is not currently planned. If enough folks 👍 this PR then we’ll consider reopening it.

Thanks for using winston!

0reactions
indexzerocommented, Jun 27, 2018

This is a long standing feature request tracked as https://github.com/winstonjs/winston/issues/200

Read more comments on GitHub >

github_iconTop Results From Across the Web

[RFC] server(less) middleware · Issue #7208 · vercel/next.js
So for the initial implementation (and incrementally working towards the implementation above) I'd start with supporting middleware in pages_document.js ...
Read more >
What's new in Next.js 12
Next 12 features include performance optimization, React 18 support, middleware, and more. Let's learn how to use these new features.
Read more >
How to Use Next.js Middleware
accepts a Promise parameter, and is essentially used to prevent computation from closing whilst the promise is unresolved.
Read more >
http-proxy-middleware
Node.js proxying made simple. Configure proxy middleware with ease for connect, express, browser-sync and many more. Powered by the popular ...
Read more >
Edge Runtime
Learn more about the supported APIs available. ... Adding AMP Components ... is based on standard Web APIs, which is used by Middleware...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found