seeding bonus log save to click house

This commit is contained in:
xiaomlove
2025-09-19 21:02:34 +07:00
parent 90c973f608
commit 8bdcacf8e7
15 changed files with 112 additions and 58 deletions

View File

@@ -209,11 +209,9 @@ function do_log($log, $level = 'info', $echo = false)
}
}
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
$dt = DateTime::createFromFormat('U.u', sprintf('%.6f', microtime(true)));
$dt->setTimezone(new DateTimeZone(nexus_env('TIMEZONE', 'UTC')));
$content = sprintf(
"[%s] [%s] [%s] [%s] [%s] [%s] %s.%s %s:%s %s%s%s %s%s",
$dt->format("Y-m-d\TH:i:s.vP"),
getDtMillis(true),
nexus() ? nexus()->getRequestId() : 'NO_REQUEST_ID',
nexus() ? nexus()->getLogSequence() : 0,
sprintf('%.3f', microtime(true) - (nexus() ? nexus()->getStartTimestamp() : 0)),
@@ -238,6 +236,20 @@ function do_log($log, $level = 'info', $echo = false)
}
}
function getDtMillis($withTimeZone = false): string {
$dt = DateTime::createFromFormat('U.u', sprintf('%.6f', microtime(true)));
$dt->setTimezone(new DateTimeZone(nexus_env('TIMEZONE', 'UTC')));
$format = $withTimeZone ? 'Y-m-d\TH:i:s.vP' : 'Y-m-d H:i:s.v';
return $dt->format($format);
}
function getDtMicro($withTimeZone = false): string {
$dt = DateTime::createFromFormat('U.u', sprintf('%.6f', microtime(true)));
$dt->setTimezone(new DateTimeZone(nexus_env('TIMEZONE', 'UTC')));
$format = $withTimeZone ? 'Y-m-d\TH:i:s.uP' : 'Y-m-d H:i:s.u';
return $dt->format($format);
}
function getLogFile($append = '')
{
static $logFiles = [];