[pve-devel] [PATCH pve-http-server] AnyEvent: add timestamps to debug logs

Laurențiu Leahu-Vlăducu l.leahu-vladucu at proxmox.com
Thu Oct 2 18:28:25 CEST 2025


This helps correlate our debug logs with other log files for
easier debugging when making API calls.

Signed-off-by: Laurențiu Leahu-Vlăducu <l.leahu-vladucu at proxmox.com>
---
 src/PVE/APIServer/AnyEvent.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
index 59bc184..cdc82b2 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -76,7 +76,9 @@ sub dprint {
 
     my ($pkg, $pkgfile, $line, $sub) = caller(1);
     $sub =~ s/^(?:.+::)+//;
-    print "worker[$$]: $pkg +$line: $sub: $message\n";
+    my ($secs, $microsecs) = gettimeofday();
+    my $timestr = strftime("%F %T", localtime($secs)) . sprintf(".%06d", $microsecs);
+    print "$timestr | worker[$$]: $pkg +$line: $sub: $message\n";
 }
 
 sub log_request {
-- 
2.47.3





More information about the pve-devel mailing list