Best practices for scoped logging
See original GitHub issueHi Probot friends!
I’m working on a bot that reacts to pull request events. For debugging purposes, I’d like to be able to tail Probot’s logs and grep for log lines that pertain to just that PR:
heroku logs -t | grep pr-123
At present, I’m thinking of creating a custom logging function in the scope of the event handler:
async function handler (context) {
function log (args) {
const prefix = `pr-${context.payload.pull_request.number}`
context.log(prefix, ...args)
}
log('some', objects, and, stuff)
})
Is there a better built-in way to includ grep-friendly context when logging?
cc @sarahs
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (7 by maintainers)
Top Results From Across the Web
How to add logging for a scoped application? - ServiceNow
Best practice for scoped applications is to create two system properties to control the destination of verbosity of logging.
Read more >Logging with ILogger in .NET: Recommendations and best ...
This article describes recommendations and best practices for using the ILogger based logging system which has been introduced with .
Read more >Logging for Scoped Applications - ServiceNow Elite
How to use log statements with scoped applications. ... The good news is that you can use these alternative log statements instead.
Read more >How to improve Serilog logging in .NET 6 by using Scopes
Finally, two must-read articles about logging best practices. The first one is by Thiago Nascimento Figueiredo: Logs - Why, good practices, ...
Read more >OAuth Scopes Best Practices | Curity
If not designed carefully, you can end up with a large number of scopes that are difficult to maintain over time. The most...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Issue-Label Bot is automatically applying the label
question ❓
to this issue, with a confidence of 0.83. Please mark this comment with 👍 or 👎 to give our bot feedback!Links: app homepage, dashboard and code for this bot.
Probot is using pino internally now, all instances should have the
.child()
method, see https://getpino.io/#/?id=usage