Skip to content

Commit

Permalink
remove overdesigned init log level
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaMoelans committed Dec 19, 2024
1 parent b617e6f commit 25076ba
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 30 deletions.
11 changes: 3 additions & 8 deletions include/sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,8 @@ SENTRY_API const char *sentry_options_get_user_agent(
const sentry_options_t *opts);

/**
* Enables or disables debug printing mode.
* Enables or disables debug printing mode. To change the log level from the
* default DEBUG level, use `sentry_options_set_logger_level`.
*/
SENTRY_API void sentry_options_set_debug(sentry_options_t *opts, int debug);

Expand All @@ -1079,17 +1080,11 @@ SENTRY_API void sentry_options_set_debug(sentry_options_t *opts, int debug);
SENTRY_API int sentry_options_get_debug(const sentry_options_t *opts);

/**
* Sets the level of the logger
* Sets the level of the logger. Has no effect if `debug` is not set to true.
*/
SENTRY_API void sentry_options_set_logger_level(
sentry_options_t *opts, sentry_level_t level);

/**
* Sets the log level for the sentry_init function
*/
SENTRY_API void sentry_options_set_init_log_level(
sentry_options_t *opts, sentry_level_t level);

/**
* Sets the number of breadcrumbs being tracked and attached to events.
*
Expand Down
7 changes: 0 additions & 7 deletions src/sentry_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ sentry_init(sentry_options_t *options)
if (options->debug) {
logger = options->logger;
}
sentry_logger_t old_logger = logger; // restore this after init
if (options->log_init) {
logger = options->logger;
logger.logger_level = options->init_logger_level;
}
sentry__logger_set_global(logger);

// we need to ensure the dir exists, otherwise `path_absolute` will fail.
Expand Down Expand Up @@ -205,8 +200,6 @@ sentry_init(sentry_options_t *options)
sentry__init_cached_functions();
#endif

sentry__logger_set_global(old_logger);

sentry__mutex_unlock(&g_options_lock);
return 0;

Expand Down
14 changes: 1 addition & 13 deletions src/sentry_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,7 @@ sentry_options_get_user_agent(const sentry_options_t *opts)
void
sentry_options_set_debug(sentry_options_t *opts, int debug)
{
if (!!debug) {
sentry_options_set_logger_level(opts, SENTRY_LEVEL_DEBUG);
} else {
opts->debug = false;
}
opts->debug = !!debug;
}

int
Expand Down Expand Up @@ -405,14 +401,6 @@ void
sentry_options_set_logger_level(sentry_options_t *opts, sentry_level_t level)
{
opts->logger.logger_level = level;
opts->debug = true;
}

void
sentry_options_set_init_log_level(sentry_options_t *opts, sentry_level_t level)
{
opts->init_logger_level = level;
opts->log_init = true;
}

void
Expand Down
2 changes: 0 additions & 2 deletions src/sentry_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ typedef struct sentry_options_s {
sentry_path_t *database_path;
sentry_path_t *handler_path;
sentry_logger_t logger;
sentry_level_t init_logger_level;
bool log_init;
size_t max_breadcrumbs;
bool debug;
bool auto_session_tracking;
Expand Down

0 comments on commit 25076ba

Please sign in to comment.