From e773cad622b86735f1673368414009475e4119fd Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 10 Jul 2024 11:16:07 -0800 Subject: [PATCH] fix(logging): don't unconditionally log to console (#4136) --- Sources/Sentry/SentryAsyncSafeLog.c | 7 +++---- Sources/Sentry/SentryAsyncSafeLog.h | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Sources/Sentry/SentryAsyncSafeLog.c b/Sources/Sentry/SentryAsyncSafeLog.c index 9a2dbb1a212..c720f1019f4 100644 --- a/Sources/Sentry/SentryAsyncSafeLog.c +++ b/Sources/Sentry/SentryAsyncSafeLog.c @@ -91,7 +91,6 @@ writeToLog(const char *const str) pos += bytesWritten; } } - write(STDOUT_FILENO, str, strlen(str)); #if SENTRY_ASYNC_SAFE_LOG_ALSO_WRITE_TO_CONSOLE // if we're debugging, also write the log statements to the console; we only check once for @@ -150,10 +149,10 @@ sentry_asyncLogSetFileName(const char *filename, bool overwrite) } void -sentry_asyncLogC(const char *const level, const char *const file, const int line, - const char *const function, const char *const fmt, ...) +sentry_asyncLogC( + const char *const level, const char *const file, const int line, const char *const fmt, ...) { - writeFmtToLog("%s: %s (%u): %s: ", level, lastPathEntry(file), line, function); + writeFmtToLog("%s: %s (%u): ", level, lastPathEntry(file), line); va_list args; va_start(args, fmt); writeFmtArgsToLog(fmt, args); diff --git a/Sources/Sentry/SentryAsyncSafeLog.h b/Sources/Sentry/SentryAsyncSafeLog.h index b86167ae6bf..40738e34fa6 100644 --- a/Sources/Sentry/SentryAsyncSafeLog.h +++ b/Sources/Sentry/SentryAsyncSafeLog.h @@ -47,8 +47,7 @@ extern "C" { static char g_logFilename[1024]; -void sentry_asyncLogC( - const char *level, const char *file, int line, const char *function, const char *fmt, ...); +void sentry_asyncLogC(const char *level, const char *file, int line, const char *fmt, ...); #define i_SENTRY_ASYNC_SAFE_LOG sentry_asyncLogC @@ -62,7 +61,7 @@ void sentry_asyncLogC( #define SENTRY_ASYNC_SAFE_LOG_LEVEL SENTRY_ASYNC_SAFE_LOG_LEVEL_ERROR #define a_SENTRY_ASYNC_SAFE_LOG(LEVEL, FMT, ...) \ - i_SENTRY_ASYNC_SAFE_LOG(LEVEL, __FILE__, __LINE__, __PRETTY_FUNCTION__, FMT, ##__VA_ARGS__) + i_SENTRY_ASYNC_SAFE_LOG(LEVEL, __FILE__, __LINE__, FMT, ##__VA_ARGS__) // ============================================================================ #pragma mark - API -