mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
seeding bonus log save to click house
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user