runtime: improve startup observability
Some checks failed
build / Linux asan (push) Has been cancelled
build / Linux release (push) Has been cancelled
build / FreeBSD build (push) Has been cancelled

This commit is contained in:
server
2026-04-14 06:04:12 +02:00
parent 3e3f0918e9
commit 7daf51f2da
3 changed files with 126 additions and 2 deletions

View File

@@ -45,6 +45,43 @@ extern const char * _malloc_options;
extern void WriteVersion();
namespace
{
const char* BoolState(bool value)
{
return value ? "on" : "off";
}
const char* EmptyToLabel(const std::string& value, const char* fallback)
{
return value.empty() ? fallback : value.c_str();
}
void LogStartupSummary(int heart_fps, int player_id_start)
{
sys_log(0,
"[STARTUP] locale=%s table_postfix=%s player_db=%s player_id_start=%d heart_fps=%d test_server=%s log=%s hotbackup=%s",
EmptyToLabel(g_stLocale, "<unset>"),
EmptyToLabel(g_stTablePostfix, "<none>"),
EmptyToLabel(g_stPlayerDBName, "<unset>"),
player_id_start,
heart_fps,
BoolState(g_test_server),
BoolState(g_log != 0),
BoolState(g_bHotBackup)
);
sys_log(0,
"[STARTUP] cache_flush player=%d item=%d pricelist=%d logout=%d locale_name_column=%s",
g_iPlayerCacheFlushSeconds,
g_iItemCacheFlushSeconds,
g_iItemPriceListTableCacheFlushSeconds,
g_iLogoutSeconds,
EmptyToLabel(g_stLocaleNameColumn, "<unset>")
);
}
}
void emergency_sig(int sig)
{
if (sig == SIGSEGV)
@@ -374,6 +411,8 @@ int Start()
return false;
}
LogStartupSummary(heart_beat, iIDStart);
#ifndef OS_WINDOWS
signal(SIGUSR1, emergency_sig);
#endif
@@ -409,4 +448,3 @@ const char * GetPlayerDBName()
{
return g_stPlayerDBName.c_str();
}