Update logger formatting, add dev script
This commit is contained in:
parent
d4e278586f
commit
df5c282d3f
2 changed files with 14 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"importMap": "./import_map.json",
|
"importMap": "./import_map.json",
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"start": "deno run -A --unstable main.ts"
|
"start": "deno run -A --unstable main.ts",
|
||||||
|
"dev": "deno run -A --unstable --watch main.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
logger.ts
13
logger.ts
|
@ -3,11 +3,22 @@ import { isDenoDeploy } from "./utils.ts";
|
||||||
|
|
||||||
log.setup({
|
log.setup({
|
||||||
handlers: {
|
handlers: {
|
||||||
console: new log.handlers.ConsoleHandler("DEBUG"),
|
console: new log.handlers.ConsoleHandler("DEBUG", {
|
||||||
|
formatter: (logRecord) => {
|
||||||
|
let msg = `${logRecord.levelName} ${logRecord.msg}`;
|
||||||
|
|
||||||
|
logRecord.args.forEach((arg, index) => {
|
||||||
|
msg += `, arg${index}: ${arg}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
},
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
loggers: {
|
loggers: {
|
||||||
default: {
|
default: {
|
||||||
level: isDenoDeploy ? "INFO" : "DEBUG",
|
level: isDenoDeploy ? "INFO" : "DEBUG",
|
||||||
|
handlers: ["console"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue