NeTT
NeTT2y ago

How do I use std/log?

I'm trying to create a log file. I don't seem to be able to make it work tho.
import { handlers, Logger } from "https://deno.land/std@0.175.0/log/mod.ts";

const file_reg = new handlers.FileHandler("INFO", {
filename: "./reg_log",
formatter: "{levelName} {msg}",
});

file_reg.setup();
const logger = new Logger("registration", "INFO", {
handlers: [file_reg],
});
// Log file is created at this point

logger.info("aaa")
// This part is not written to the file
import { handlers, Logger } from "https://deno.land/std@0.175.0/log/mod.ts";

const file_reg = new handlers.FileHandler("INFO", {
filename: "./reg_log",
formatter: "{levelName} {msg}",
});

file_reg.setup();
const logger = new Logger("registration", "INFO", {
handlers: [file_reg],
});
// Log file is created at this point

logger.info("aaa")
// This part is not written to the file
0 Replies
No replies yetBe the first to reply to this messageJoin