how to get diagnostic logs objetivec
Description
How can I obtain the logs for mild diagnostics? I am creating a plugin for NativeScript. For example:
new io.sentry.ILogger({
isEnabled(param0: io.sentry.SentryLevel) {
that.printf(param0);
return value;
},
log(param0: io.sentry.SentryLevel, param1: java.lang.Throwable, param2: string, param3: androidNative.Array<any>) {
that.printf(`${param0} - ${param1} - ${param2} - ${param3}`);
},
})
from Android. The logs from NativeScript do not directly display Sentry logs.
Hi @MariaC15, can you please clarify what you are trying to achieve? And does your use case work on Android the way you described it?
Hello, I apologize for not explaining more clearly. I'm creating a plugin for NativeScript using the Sentry libraries for Android and iOS. Due to NativeScript's compilation process for Android and iOS, the logs are not displayed. I resolved this issue for Android using the following approach:
set logger(value: boolean) {
const that = this;
this.config.setLogger(
new io.sentry.ILogger({
isEnabled(param0: io.sentry.SentryLevel) {
that.printf(param0);
return value;
},
log(param0: io.sentry.SentryLevel, param1: java.lang.Throwable, param2: string, param3: androidNative.Array<any>) {
that.printf(`${param0} - ${param1} - ${param2} - ${param3}`);
},
})
);
this.printf('logger');
}
This solution works correctly for Android, but on iOS, the logs are not visible when compiled through NativeScript. They only appear in Xcode when compiled directly from Xcode. Is it possible to use a similar method to the logger in the Swift library?
Thanks for the explanation! sentry-cocoa currently does not support setting a custom logger, so your use case is currently not supported. We'll discuss if it makes sense to open this up.