From 6a783ea179de1321ae7fd0586967476e72984c63 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 1 Jan 2019 22:46:17 -0500 Subject: Add testing module Original: https://github.com/denoland/deno_std/commit/61fdae51a7cc50874b9674c40b1aef3fbf012494 --- logging/README.md | 26 +++++++++++++------------- logging/test.ts | 3 +-- 2 files changed, 14 insertions(+), 15 deletions(-) (limited to 'logging') 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"; -- cgit v1.2.3