-
-
Notifications
You must be signed in to change notification settings - Fork 377
meta: add log source to format; update log format #2337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| SENTRY_LOG_DEBUG(@"SentryHttpTransport: RateLimit is active for all envelope items."); | ||
| SENTRY_LOG_DEBUG(@"RateLimit is active for all envelope items."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed these in favor of the automatic injection in the macros.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sources/Sentry/include/SentryLog.h
Outdated
| [SentryLog logWithMessage:[NSString stringWithFormat:__VA_ARGS__] andLevel:kSentryLevelDebug] | ||
| [SentryLog logWithMessage:[NSString stringWithFormat:@"[%@:%d] %@", \ | ||
| [[[NSString stringWithUTF8String:__FILE__] \ | ||
| lastPathComponent] stringByDeletingPathExtension], \ | ||
| __LINE__, [NSString stringWithFormat:__VA_ARGS__]] \ | ||
| andLevel:kSentryLevelDebug] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change that automatically adds the log source to all logs using these macros.
brustolin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
I have wanted to do this already for a while 😁. 🥇 to you @armcknight for finally doing that. |
As I've been adding more logging, it's getting harder to keep track of things. This PR adds a new part to the format denoting which class/file the log originated from (and the line number). I also standardized how the different tokens are formatted in the log statement, like our SDK name, log level, and the newly added log source.
Before:
after
Someone had actually started doing this from
SentryHttpTransport, which I removed from the actual log strings to deduplicate as this solves the same problem from the logging macros themselves so that anywhere they're used, this appears in the logs. It must be done in the macros, since it uses the__FILE__builtin; if that were used in SentryLogOutput.m, then all the log statements would contain[SentryLogOutput].#skip-changelog