Benchmark logging

This commit is contained in:
2022-04-03 21:52:44 +09:00
parent a7f5cdbeb5
commit 38f2911266
5 changed files with 35 additions and 18 deletions

View File

@@ -50,7 +50,7 @@ class PageCache
, headers: {
"Content-Length": res.headers[ "Content-Length" ]
, "Content-Type": res.headers[ "Content-Type" ]
, "X-Cache-Expires": new Date( expires )
, "X-Cache-Expirls": new Date( expires ).toISOString()
}
, statusCode: res.statusCode
, ttl: expires
@@ -87,18 +87,19 @@ class PageCache
if( url in store )
{
Dragonfly.Info(
"[C] "
+ ( req.headers[ "x-forwarded-for" ] || req.connection.remoteAddress ) + " "
+ req.method + ": " + encodeURI( url )
+ " - " + req.headers["user-agent"]
, Dragonfly.Visibility.VISIBLE
);
var c = store[ url ];
res.writeHead( c.statusCode, c.headers );
res.end( c.data );
Dragonfly.Info(
"[C] "
+ ( req.headers[ "x-forwarded-for" ] || req.connection.remoteAddress ) + " "
+ req.method + ": " + url
+ " - " + req.headers["user-agent"]
+ ` in ${process.hrtime.bigint() - res._hrtime}ns`
, Dragonfly.Visibility.VISIBLE
);
return true;
}