Skip to content

Commit ef1b6da

Browse files
committed
fix(utils): keep server banner independent from log format
1 parent 544f6cb commit ef1b6da

1 file changed

Lines changed: 0 additions & 67 deletions

File tree

‎include/vix/utils/ServerPrettyLogs.hpp‎

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -326,46 +326,6 @@ namespace vix::utils
326326
{
327327
vix::utils::console_reset_banner();
328328

329-
if (structured_logs_enabled())
330-
{
331-
const std::string http_url = make_http_url(info);
332-
const std::string ws_url = (info.show_ws ? make_ws_url(info) : std::string());
333-
auto &logger = vix::utils::Logger::getInstance();
334-
335-
if (info.show_ws)
336-
{
337-
logger.logf(
338-
vix::utils::Logger::Level::Info,
339-
"server_ready",
340-
"app", info.app,
341-
"version", info.version,
342-
"ready_ms", info.ready_ms,
343-
"mode", info.mode.empty() ? std::string("run") : info.mode,
344-
"status", info.status.empty() ? std::string("ready") : info.status,
345-
"http_url", http_url,
346-
"ws_url", ws_url,
347-
"threads", static_cast<unsigned long long>(info.threads),
348-
"max_threads", static_cast<unsigned long long>(info.max_threads));
349-
}
350-
else
351-
{
352-
logger.logf(
353-
vix::utils::Logger::Level::Info,
354-
"server_ready",
355-
"app", info.app,
356-
"version", info.version,
357-
"ready_ms", info.ready_ms,
358-
"mode", info.mode.empty() ? std::string("run") : info.mode,
359-
"status", info.status.empty() ? std::string("ready") : info.status,
360-
"http_url", http_url,
361-
"threads", static_cast<unsigned long long>(info.threads),
362-
"max_threads", static_cast<unsigned long long>(info.max_threads));
363-
}
364-
365-
vix::utils::console_mark_banner_done();
366-
return;
367-
}
368-
369329
const bool color = colors_enabled();
370330
const std::string http_url = make_http_url(info);
371331
const std::string ws_url = (info.show_ws ? make_ws_url(info) : std::string());
@@ -457,33 +417,6 @@ namespace vix::utils
457417
return "\033[38;5;110m" + s + "\033[0m";
458418
}
459419

460-
/**
461-
* @brief Determine whether banner animations are enabled.
462-
*
463-
* Rules:
464-
* - Disabled if VIX_NO_ANIM is set (and non-empty)
465-
* - Requires stderr to be a TTY
466-
* - Disabled if NO_COLOR is set (and non-empty)
467-
*
468-
* @return True if small animations may be shown.
469-
*/
470-
static bool structured_logs_enabled()
471-
{
472-
const char *raw = vix_getenv("VIX_LOG_FORMAT");
473-
if (!raw || !*raw)
474-
return false;
475-
476-
std::string value(raw);
477-
for (auto &c : value)
478-
c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
479-
480-
return value == "json" ||
481-
value == "json-pretty" ||
482-
value == "json_pretty" ||
483-
value == "pretty-json" ||
484-
value == "pretty_json";
485-
}
486-
487420
static bool animations_enabled()
488421
{
489422
if (const char *no = vix_getenv("VIX_NO_ANIM"); no && *no)

0 commit comments

Comments
 (0)