feature/IO-3029-Enhanced-Logging-File-Based: Add File based S3 Logging.
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -15,7 +15,7 @@ const { canvastest } = require("../render/canvas-handler");
|
||||
const { alertCheck } = require("../alerts/alertcheck");
|
||||
|
||||
//Test route to ensure Express is responding.
|
||||
router.get("/test", async function (req, res) {
|
||||
router.get("/test", eventAuthorizationMiddleware, async function (req, res) {
|
||||
const commit = require("child_process").execSync("git rev-parse --short HEAD");
|
||||
// console.log(app.get('trust proxy'));
|
||||
// console.log("remoteAddress", req.socket.remoteAddress);
|
||||
@@ -32,6 +32,30 @@ router.get("/test", async function (req, res) {
|
||||
res.status(200).send(`OK - ${commit}`);
|
||||
});
|
||||
|
||||
router.get("/test-logs", eventAuthorizationMiddleware, (req, res) => {
|
||||
const { logger } = req;
|
||||
// // Test 1: Log with a message that exceeds the size limit, triggering an upload to S3.
|
||||
const largeMessage = "A".repeat(256 * 1024 + 1); // Message larger than the log size limit
|
||||
logger.log(largeMessage, "error", "user123", null, { detail: "large log entry" });
|
||||
|
||||
// Test 2: Log with a message that is within the size limit, should log directly using winston.
|
||||
const smallMessage = "A small log message";
|
||||
logger.log(smallMessage, "info", "user123", null, { detail: "small log entry" });
|
||||
|
||||
// Test 3: Log with the `upload` flag set to `true`, forcing the log to be uploaded to S3.
|
||||
logger.log(
|
||||
"This log will be uploaded to S3 regardless of size",
|
||||
"warning",
|
||||
"user123",
|
||||
null,
|
||||
{ detail: "upload log" },
|
||||
true
|
||||
);
|
||||
|
||||
// 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" });
|
||||
});
|
||||
|
||||
// Search
|
||||
router.post("/search", validateFirebaseIdTokenMiddleware, withUserGraphQLClientMiddleware, os.search);
|
||||
router.post("/opensearch", eventAuthorizationMiddleware, os.handler);
|
||||
|
||||
Reference in New Issue
Block a user