1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00

adjust docs for std/log (#4984)

This commit is contained in:
张超杰 2020-04-29 21:38:44 +08:00 committed by GitHub
parent 2337fca277
commit 17cf2ecdac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,7 +19,7 @@ await log.setup({
handlers: {
console: new log.handlers.ConsoleHandler("DEBUG"),
file: new log.handlers.FileHandler(log.LogLevels.DEBUG, {
file: new log.handlers.FileHandler("WARNING", {
filename: "./log.txt",
// you can change format of output message using any keys in `LogRecord`
formatter: "{levelName} {msg}",
@ -34,7 +34,7 @@ await log.setup({
},
tasks: {
level: log.LogLevels.ERROR,
level: "ERROR",
handlers: ["console"],
},
},
@ -55,7 +55,7 @@ logger.error("buzz"); // log to `console`
// if you try to use a logger that hasn't been configured
// you're good to go, it gets created automatically with level set to 0
// so no message is logged
unknownLogger = log.getLogger("mystery");
const unknownLogger = log.getLogger("mystery");
unknownLogger.info("foobar"); // no-op
```