diff options
| author | Ryan Dahl <ry@tinyclouds.org> | 2019-01-01 22:46:17 -0500 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-01-02 13:45:42 -0500 |
| commit | 6a783ea179de1321ae7fd0586967476e72984c63 (patch) | |
| tree | cafa2e3716ee3dcfa88354e4a7190cab7e436613 /logging | |
| parent | 6545e5bde9454e9ae7ab61b0f4ee95db8a15e43c (diff) | |
Add testing module
Original: https://github.com/denoland/deno_std/commit/61fdae51a7cc50874b9674c40b1aef3fbf012494
Diffstat (limited to 'logging')
| -rw-r--r-- | logging/README.md | 26 | ||||
| -rw-r--r-- | logging/test.ts | 3 |
2 files changed, 14 insertions, 15 deletions
diff --git a/logging/README.md b/logging/README.md index 4d7e95474..1d88cb070 100644 --- a/logging/README.md +++ b/logging/README.md @@ -12,27 +12,27 @@ log.critical("500 Internal server error"); // configure as needed await log.setup({ - handlers: { - console: new log.handlers.ConsoleHandler("DEBUG"), - file: new log.handlers.FileHandler("WARNING", "./log.txt"), - }, + handlers: { + console: new log.handlers.ConsoleHandler("DEBUG"), + file: new log.handlers.FileHandler("WARNING", "./log.txt") + }, - loggers: { - default: { - level: "DEBUG", - handlers: ["console", "file"], - } + loggers: { + default: { + level: "DEBUG", + handlers: ["console", "file"] } + } }); // get configured logger const logger = log.getLogger("default"); -logger.debug("fizz") // <- logs to `console`, because `file` handler requires 'WARNING' level -logger.warning("buzz") // <- logs to both `console` and `file` handlers +logger.debug("fizz"); // <- logs to `console`, because `file` handler requires 'WARNING' level +logger.warning("buzz"); // <- logs to both `console` and `file` handlers // 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 const unknownLogger = log.getLogger("mystery"); -unknownLogger.info("foobar") // no-op -```
\ No newline at end of file +unknownLogger.info("foobar"); // no-op +``` diff --git a/logging/test.ts b/logging/test.ts index 4808b5944..b96a046dd 100644 --- a/logging/test.ts +++ b/logging/test.ts @@ -1,6 +1,5 @@ import { remove, open, readAll } from "deno"; -import { assertEqual, test } from "https://deno.land/x/testing/testing.ts"; - +import { assertEqual, test } from "../testing/mod.ts"; import * as log from "index.ts"; import { FileHandler } from "./handlers.ts"; |
