Skip to content

Commit

Permalink
fix(log): await default logger setup (denoland/deno#5341)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosc90 authored and caspervonb committed Jan 31, 2021
1 parent 13937b6 commit 73cdb07
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion log/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@ export async function setup(config: LogConfig): Promise<void> {
}
}

setup(DEFAULT_CONFIG);
await setup(DEFAULT_CONFIG);
16 changes: 16 additions & 0 deletions log/mod_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
const { test } = Deno;
import { Logger } from "./logger.ts";
import { assert } from "../testing/asserts.ts";
import { getLogger } from "./mod.ts";

let logger: Logger | null = null;
try {
// Need to initialize it here
// otherwise it will be already initialized on Deno.test
logger = getLogger();
} catch {}

test("logger is initialized", function (): void {
assert(logger instanceof Logger);
});

0 comments on commit 73cdb07

Please sign in to comment.