feature/IO-3029-Enhanced-Logging-File-Based: Add fix bugs

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-11-13 13:09:37 -08:00
parent f3d8aa3438
commit cba2da8da7
2 changed files with 9 additions and 1 deletions

View File

@@ -54,6 +54,8 @@ router.get("/test-logs", eventAuthorizationMiddleware, (req, res) => {
// Test 4: Log with a message that doesn't exceed the size limit and doesn't require an upload.
logger.log("Normal log entry", "debug", "user123", { id: 4 }, { detail: "normal log entry" });
return res.status(500).send("Logs tested.");
});
// Search

View File

@@ -191,7 +191,13 @@ const createLogger = () => {
return false;
};
if (upload || checkAndUploadLog()) return;
// Upload log immediately if upload is true, otherwise check the log size.
if (upload) {
uploadLogToS3(logEntry, message, type, user);
return;
}
if (checkAndUploadLog()) return;
winstonLogger.log(logEntry);
};