Philipp Hofmann
Philipp Hofmann
Hey @fzyzcjy, which types of logs are you referring to? Would you please post some code snippets? Why do you want your logs as breadcrumbs anyway?
We currently don't support redirecting the output of NSLog, Swift's Logger, or `println`. They use stderr and/or log messages to the Apple System Logging (asl) facility. You could maybe redirect...
Sorry for the late reply. Why do you want to capture third-party logs, @fzyzcjy? Just to understand your use case.
[Java](https://github.com/getsentry/sentry-java/blob/61ea65371ae9c7ea52ecefcc6b67817f47f4c042/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java#L60-L120), [.NET](https://github.com/getsentry/sentry-dotnet/blob/6b080dcd7091abb17dc987d759080261384303c0/src/Sentry.Extensions.Logging/SentryLogger.cs#L34-L126), Python already have a similar feature. We need to investigate how we can hook into NSLog so we achieve this. One idea would be to redirect the stderr...
We might be able to stream the logs from the OSLogStore, see https://steipete.com/posts/logging-in-swift/#update-ios-15 and https://github.com/steipete/OSLogTest.
Thank you, @garriguv, for the update. 👏 > A better approach could be to attach the logs from the last hour as breadcrumbs with every Sentry event using the beforeSend...
Hacktoberfest is actually for contributing to open source. I added the tag because I thought it might be something a contributor could have a shot at. Thanks for the update,...
As pointed out by @brustolin, we have an experimental feature for this @kabiroberai. You can enable `stitchAsyncCode` and let us know what you think. https://github.com/getsentry/sentry-cocoa/blob/17a7a28bf01bb7c7a095bbd0cded5e6bc1dd65aa/Sources/Sentry/Public/SentryOptions.h#L144-L152
I created an issue for pointing that out in the docs and the wizard https://github.com/getsentry/sentry-docs/issues/5215.
Thanks for pointing that out, @kabiroberai. Yes, the solution should be similar to `stitchAsyncCode` for GCD.