From ef89c146f6ef3f0091ce2f4736cbda2dd7cf84a0 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Mon, 12 Sep 2022 23:38:47 +0200 Subject: enable json log file (#164) * Include source location on ZEN_ERROR and ZEN_CRITICAL * Use proper logging for sentry init status * format file logger as json if .json extension is given * changelog --- zenserver/zenserver.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'zenserver/zenserver.cpp') diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index 759c08476..1c94d80b7 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -948,7 +948,7 @@ ZenEntryPoint::Run() { #if ZEN_USE_SENTRY std::string SentryDatabasePath = PathToUtf8(m_ServerOptions.DataDir / ".sentry-native"); - + int SentryErrorCode = 0; if (m_ServerOptions.NoSentry == false) { sentry_options_t* SentryOptions = sentry_options_new(); @@ -959,14 +959,7 @@ ZenEntryPoint::Run() sentry_options_set_release(SentryOptions, ZEN_CFG_VERSION); // sentry_options_set_debug(SentryOptions, 1); - if (int ErrorCode = sentry_init(SentryOptions); ErrorCode == 0) - { - printf("sentry initialized"); - } - else - { - printf("sentry_init returned failure! (error code: %d)", ErrorCode); - } + SentryErrorCode = sentry_init(SentryOptions); } auto _ = zen::MakeGuard([] { sentry_close(); }); @@ -1002,6 +995,17 @@ ZenEntryPoint::Run() InitializeLogging(ServerOptions); +#if ZEN_USE_SENTRY + if (SentryErrorCode == 0) + { + ZEN_INFO("sentry initialized"); + } + else + { + ZEN_WARN("sentry_init returned failure! (error code: {})", SentryErrorCode); + } +#endif + MaximizeOpenFileCount(); ZEN_INFO(ZEN_APP_NAME " - using lock file at '{}'", LockFilePath); -- cgit v1.2.3