18 lines
380 B
TypeScript
18 lines
380 B
TypeScript
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
|
|
}
|
|
}
|