+27
-4
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.w = exports.namespaces = void 0; | ||
| exports.namespaces = void 0; | ||
| exports.w = w; | ||
| const types_ts_1 = require("./types.js"); | ||
@@ -12,4 +13,27 @@ const colours_ts_1 = require("./colours.js"); | ||
| const debug = types_ts_1.context.console.Console?.(stderr)?.debug || types_ts_1.context.console.debug; | ||
| /** | ||
| * The underlying namespace manager. | ||
| */ | ||
| exports.namespaces = new namespacing_ts_1.Namespaces(DEBUG); | ||
| const w = (namespace = "") => { | ||
| /** | ||
| * 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. | ||
| */ | ||
| function w(namespace = "") { | ||
| const debugfn = (...args) => { | ||
@@ -30,3 +54,2 @@ if (debugfn.enabled) { | ||
| return debugfn; | ||
| }; | ||
| exports.w = w; | ||
| } |
+1
-1
| { | ||
| "name": "w", | ||
| "version": "2.1.4", | ||
| "version": "2.1.5", | ||
| "homepage": "https://github.com/feathers-studio/wiretap", | ||
@@ -5,0 +5,0 @@ "repository": { |
12607
4.18%153
17.69%