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
constlc=newLogContext().addContext('a','b');lc?.info('c','d');// roughly same as console.info('a=b','c','d');
This might not be too bad if it wasn't that our context always starts with the clientID which is ephemeral. For tools like Sentry that means that it is impossible to group the log lines.
An alternative approach would be to attach the context as a "JSON object". Then we would get something like:
constlc=newLogContext().addContext('a','b');lc?.info('c','d');// roughly same as console.info('c','d',{a: 'b'});
Then sentry would display this something along the lines of:
The text was updated successfully, but these errors were encountered:
Yes this seems sensible, when it comes time to implement I'd like to talk about what goes into the message vs the attached extra context. There are a couple of ways we could go and it has bearing on how we log server-side, because we use LogContext ubiquitously and have have a few requirements on the server that are less relevant on the client.
I was looking at this and a few questions (trying to setup Sentry myself to experiment):
Can it really be true that it's impossible in Sentry to group by something other than the leading parameter?? It's quite pleasant/easy to read for me with clientID at the head of the line when displayed textually.
Is it just the order of the log line that matters? If the context was at the end, textually, would that help?
@aboodman Sentry can be configured how to group issues. But it is a more sophisticated effort and I think having sane grouping by default would be beneficial.
I think just the log message itself is a very strong parameter on whether something is the same error or not.
We have an internal class called
LogContext
. It's implementation is at https://github.com/rocicorp/logger/blob/main/src/logger.ts#L145Basic usage is:
This might not be too bad if it wasn't that our context always starts with the clientID which is ephemeral. For tools like Sentry that means that it is impossible to group the log lines.
An alternative approach would be to attach the context as a "JSON object". Then we would get something like:
Then sentry would display this something along the lines of:
The text was updated successfully, but these errors were encountered: