Added API key authentication.

This commit is contained in:
2024-08-31 04:59:05 +02:00
parent da893c1a76
commit e8864ce35b
20 changed files with 514 additions and 28 deletions

View File

@@ -34,3 +34,20 @@ export default function initLogger(customLabel) {
],
});
}
export function initAccessLogger() {
return winston.createLogger({
level: 'access',
levels: {
access: 0,
},
format: winston.format.printf((data) => JSON.stringify({ ...data.message, timestamp: new Date() })),
transports: [
new winston.transports.DailyRotateFile({
datePattern: 'YYYY-MM-DD',
filename: path.join('log', 'access_%DATE%.log'),
level: 'access',
}),
],
});
}