runtime: improve startup observability
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user