From a7c09261e648dc484079f7d8d2f0125aae17e837 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Thu, 6 Jun 2024 07:43:22 +1000 Subject: [PATCH] refactor(log): cleanup use of `@std/assert` (#4973) * refactor(log): cleanup use of `@std/assert` * update graph --- .github/dependency_graph.svg | 388 +++++++++++++++++------------------ log/get_logger.ts | 10 +- 2 files changed, 196 insertions(+), 202 deletions(-) diff --git a/.github/dependency_graph.svg b/.github/dependency_graph.svg index bef19281b..a9c7b3e9d 100644 --- a/.github/dependency_graph.svg +++ b/.github/dependency_graph.svg @@ -4,523 +4,517 @@ - + std_deps - + archive - -archive + +archive io - -io + +io archive->io - - + + assert - -assert + +assert archive->assert - - + + io->assert - - + + bytes - -bytes + +bytes io->bytes - - + + internal - -internal + +internal assert->internal - - + + async - -async + +async cli - -cli + +cli collections - -collections + +collections crypto - -crypto + +crypto csv - -csv + +csv csv->assert - - + + streams - -streams + +streams csv->streams - - + + - + streams->io - - + + - + streams->assert - - + + - + streams->bytes - - + + data_\nstructures - -data_ -structures + +data_ +structures datetime - -datetime + +datetime dotenv - -dotenv + +dotenv encoding - -encoding + +encoding expect - -expect + +expect expect->assert - - + + expect->internal - - + + fmt - -fmt + +fmt front_\nmatter - -front_ -matter + +front_ +matter toml - -toml + +toml front_\nmatter->toml - - + + yaml - -yaml + +yaml front_\nmatter->yaml - - + + - + toml->collections - - + + fs - -fs + +fs path - -path + +path fs->path - - + + html - -html + +html http - -http + +http http->assert - - + + http->async - - + + http->cli - - + + http->streams - - + + http->encoding - - + + http->fmt - - + + http->path - - + + media_types - -media_types + +media_types http->media_types - - + + net - -net + +net http->net - - + + ini - -ini + +ini json - -json + +json json->streams - - + + jsonc - -jsonc + +jsonc jsonc->json - - + + log - -log + +log log->io - - - - - -log->assert - - + + log->fmt - - + + log->fs - - + + media_\ntypes - -media_ -types + +media_ +types msgpack - -msgpack + +msgpack - + msgpack->bytes - - + + regexp - -regexp + +regexp semver - -semver + +semver testing - -testing + +testing - + testing->assert - - + + - + testing->internal - - + + - + testing->async - - + + - + testing->fmt - - + + - + testing->fs - - + + - + testing->path - - + + data_structures - -data_structures + +data_structures - + testing->data_structures - - + + text - -text + +text - + text->assert - - + + ulid - -ulid + +ulid url - -url + +url - + url->path - - + + uuid - -uuid + +uuid - + uuid->bytes - - + + - + uuid->crypto - - + + webgpu - -webgpu + +webgpu - + webgpu->assert - - + + diff --git a/log/get_logger.ts b/log/get_logger.ts index b0d97d88c..98df3dfeb 100644 --- a/log/get_logger.ts +++ b/log/get_logger.ts @@ -1,7 +1,6 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // This module is browser compatible. -import { assert } from "@std/assert/assert"; import { Logger } from "./logger.ts"; import { state } from "./_state.ts"; @@ -9,10 +8,11 @@ import { state } from "./_state.ts"; export function getLogger(name?: string): Logger { if (!name) { const d = state.loggers.get("default"); - assert( - d !== undefined, - `"default" logger must be set for getting logger without name`, - ); + if (d === undefined) { + throw new Error( + `"default" logger must be set for getting logger without name`, + ); + } return d; } const result = state.loggers.get(name);