mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
refactor console imports, added config update event
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { type Event, type EventClass, InvalidEventReturn } from "./Event";
|
||||
import { EventListener, type ListenerHandler, type ListenerMode } from "./EventListener";
|
||||
import { $console } from "core";
|
||||
import { $console } from "core/utils";
|
||||
|
||||
export type RegisterListenerConfig =
|
||||
| ListenerMode
|
||||
|
||||
@@ -38,7 +38,6 @@ export {
|
||||
} from "./object/schema";
|
||||
|
||||
export * from "./drivers";
|
||||
export * from "./console";
|
||||
export * from "./events";
|
||||
|
||||
// compatibility
|
||||
|
||||
@@ -2,7 +2,7 @@ import { extension, guess, isMimeType } from "media/storage/mime-types-tiny";
|
||||
import { randomString } from "core/utils/strings";
|
||||
import type { Context } from "hono";
|
||||
import { invariant } from "core/utils/runtime";
|
||||
import { $console } from "../console";
|
||||
import { $console } from "./console";
|
||||
|
||||
export function getContentName(request: Request): string | undefined;
|
||||
export function getContentName(contentDisposition: string): string | undefined;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./console";
|
||||
export * from "./browser";
|
||||
export * from "./objects";
|
||||
export * from "./strings";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { $console } from "core";
|
||||
import { $console } from "./console";
|
||||
|
||||
type ConsoleSeverity = "log" | "warn" | "error";
|
||||
const _oldConsoles = {
|
||||
@@ -36,14 +36,14 @@ export function disableConsoleLog(severities: ConsoleSeverity[] = ["log", "warn"
|
||||
severities.forEach((severity) => {
|
||||
console[severity] = () => null;
|
||||
});
|
||||
$console.setLevel("critical");
|
||||
$console?.setLevel("critical");
|
||||
}
|
||||
|
||||
export function enableConsoleLog() {
|
||||
Object.entries(_oldConsoles).forEach(([severity, fn]) => {
|
||||
console[severity as ConsoleSeverity] = fn;
|
||||
});
|
||||
$console.resetLevel();
|
||||
$console?.resetLevel();
|
||||
}
|
||||
|
||||
export function formatMemoryUsage() {
|
||||
|
||||
Reference in New Issue
Block a user