D
Deno

help

How do I use std/log?

NNeTT1/30/2023
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

Looking for more? Join the community!