fix: add admin
This commit is contained in:
17
server/utils/requestLogger.ts
Normal file
17
server/utils/requestLogger.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export interface RequestLogEntry {
|
||||
ip: string;
|
||||
path: string;
|
||||
method: string;
|
||||
statusCode: number;
|
||||
userAgent: string;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export function logRequest(data: RequestLogEntry): void {
|
||||
try {
|
||||
const redis = getRedis();
|
||||
redis.lpush("request-logs", JSON.stringify(data)).catch(() => {});
|
||||
} catch {
|
||||
// Never let logging break API responses
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user