| export type Colour = [r: number, g: number, b: number, hex: string]; | ||
| export declare function selectColour(ns: string): Colour; | ||
| export declare const colourNs: (ns: string) => string; |
| export declare const context: { | ||
| document?: unknown; | ||
| alert?: (message: string) => void; | ||
| process?: { | ||
| env: { | ||
| [key: string]: string; | ||
| }; | ||
| stderr: { | ||
| isTTY: boolean; | ||
| }; | ||
| exit: (code: number) => void; | ||
| }; | ||
| env?: { | ||
| [key: string]: string; | ||
| }; | ||
| Deno?: { | ||
| permissions: { | ||
| querySync: (options: { | ||
| name: string; | ||
| variable: string; | ||
| }) => { | ||
| state: string; | ||
| }; | ||
| }; | ||
| }; | ||
| console: { | ||
| log?: (...args: unknown[]) => void; | ||
| error?: (...args: unknown[]) => void; | ||
| debug?: (...args: unknown[]) => void; | ||
| Console?: (stderr: unknown) => (typeof context)["console"]; | ||
| }; | ||
| }; |
| export declare const env: (variable: string) => string; |
| export type Namespace = { | ||
| allowed: boolean; | ||
| children: { | ||
| [key: string]: Namespace; | ||
| }; | ||
| }; | ||
| export declare class Namespaces { | ||
| parsed: Namespace; | ||
| constructor(debugspec: string); | ||
| update(debugspec: string): void; | ||
| check(namespace: string): boolean; | ||
| } |
+48
| import { Namespaces } from "./namespacing.ts"; | ||
| /** | ||
| * The underlying namespace manager. | ||
| */ | ||
| export declare const namespaces: Namespaces; | ||
| /** | ||
| * A debug logger instance. | ||
| */ | ||
| export interface DebugFn { | ||
| (...data: unknown[]): void; | ||
| /** | ||
| * Manually enable or disable logging for this namespace. | ||
| */ | ||
| enabled: boolean; | ||
| /** | ||
| * The underlying logger function. By default, this writes to `stderr`. | ||
| * To customise, assign a different logger function. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * const log = w("app"); | ||
| * log.logger = console.log.bind(console); | ||
| * ``` | ||
| */ | ||
| logger: (...args: unknown[]) => void; | ||
| panic: (...args: unknown[]) => never; | ||
| } | ||
| /** | ||
| * Create a debug instance for a namespace. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import { w } from "w"; | ||
| * const log = w("app"); | ||
| * log("hello"); | ||
| * ``` | ||
| * | ||
| * Logging for given namespace is enabled when the `DEBUG` environment variable includes the namespace. | ||
| * Multiple namespaces can be enabled by separating them with commas. | ||
| * | ||
| * ```sh | ||
| * DEBUG=app:init,app:auth,server:* bun run app.ts | ||
| * ``` | ||
| * | ||
| * @param namespace - The namespace to debug. | ||
| * @returns A debug instance. | ||
| */ | ||
| export declare function w(namespace?: string): DebugFn; |
+1
-1
| { | ||
| "name": "w", | ||
| "version": "2.3.0", | ||
| "version": "2.3.1", | ||
| "homepage": "https://github.com/feathers-studio/wiretap", | ||
@@ -5,0 +5,0 @@ "repository": { |
14464
21.02%13
62.5%262
57.83%