fix: set log level before constructing tr_session (#5345)

This commit is contained in:
tearfur 2023-04-04 04:37:28 +08:00 committed by GitHub
parent e68c72daa4
commit 931beba56f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -577,16 +577,16 @@ tr_session* tr_sessionInit(char const* config_dir, bool message_queueing_enabled
tr_timeUpdate(time(nullptr));
/* initialize the bare skeleton of the session object */
auto* const session = new tr_session{ config_dir };
bandwidthGroupRead(session, config_dir);
// nice to start logging at the very beginning
if (auto val = int64_t{}; tr_variantDictFindInt(client_settings, TR_KEY_message_level, &val))
{
tr_logSetLevel(static_cast<tr_log_level>(val));
}
/* initialize the bare skeleton of the session object */
auto* const session = new tr_session{ config_dir };
bandwidthGroupRead(session, config_dir);
auto data = tr_session::init_data{};
data.config_dir = config_dir;
data.message_queuing_enabled = message_queueing_enabled;