deno.land / std@0.224.0 / log / get_logger.ts

get_logger.ts
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.// This module is browser compatible.
import { assert } from "../assert/assert.ts";import { Logger } from "./logger.ts";import { state } from "./_state.ts";
/** Get a logger instance. If not specified `name`, get the default logger. */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`, ); return d; } const result = state.loggers.get(name); if (!result) { const logger = new Logger(name, "NOTSET", { handlers: [] }); state.loggers.set(name, logger); return logger; } return result;}
std

Version Info

Tagged at
6 months ago