diff options
| author | Dan Engelbrecht <[email protected]> | 2024-08-14 09:23:19 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-08-14 09:23:19 +0200 |
| commit | 501d5e3b0be37ebceda96240af1e4d8df927d68f (patch) | |
| tree | 1279228466433e992ec1dd2635c317d1ce78dcc3 /src/zenserver/main.cpp | |
| parent | don't try to memcache the empty buffer if invalid format (#110) (diff) | |
| download | zen-501d5e3b0be37ebceda96240af1e4d8df927d68f.tar.xz zen-501d5e3b0be37ebceda96240af1e4d8df927d68f.zip | |
improve logging on main failure (#111)
* add support for indenting callstack output
* Explicitly catch option-parse error and reduce log spam on bad parameters
* add command line to sentry error reports
* log command line at startup
Diffstat (limited to 'src/zenserver/main.cpp')
| -rw-r--r-- | src/zenserver/main.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp index 023abc8a3..c27d4eb04 100644 --- a/src/zenserver/main.cpp +++ b/src/zenserver/main.cpp @@ -5,6 +5,7 @@ #include <zencore/compactbinarybuilder.h> #include <zencore/compactbinaryvalidation.h> #include <zencore/config.h> +#include <zencore/except.h> #include <zencore/filesystem.h> #include <zencore/fmtutils.h> #include <zencore/logging.h> @@ -92,10 +93,9 @@ ZenEntryPoint::Run() std::string SentryDatabasePath = (m_ServerOptions.DataDir / ".sentry-native").string(); std::string SentryAttachmentPath = m_ServerOptions.AbsLogFile.string(); - Sentry.Initialize(SentryDatabasePath, SentryAttachmentPath, m_ServerOptions.SentryAllowPII); + Sentry.Initialize(SentryDatabasePath, SentryAttachmentPath, m_ServerOptions.SentryAllowPII, m_ServerOptions.CommandLine); } #endif - try { // Mutual exclusion and synchronization @@ -179,6 +179,8 @@ ZenEntryPoint::Run() InitializeServerLogging(m_ServerOptions); + ZEN_INFO("Command line: {}", m_ServerOptions.CommandLine); + #if ZEN_USE_SENTRY Sentry.LogStartupInformation(); #endif @@ -437,6 +439,12 @@ main(int argc, char* argv[]) return App.Run(); #endif } + catch (const OptionParseException& ParseEx) + { + // The parsing error already outputs all the details so no need to output the command line here + fprintf(stderr, "ERROR: %s\n", ParseEx.what()); + return 1; + } catch (const AssertException& AssertEx) { fprintf(stderr, "ERROR: Caught assert exception in main: '%s'", AssertEx.FullDescription().c_str()); |