Skip to main content

logger

Logger singleton module.

LogLevel​

Defined in: index.ts:46

Log levels supported by the logger.

Remarks​

The logger supports standard console methods plus custom 'success' level for framework-specific integrations like Docusaurus.

Enumeration Members​

debug​

debug: "debug";

Defined in: index.ts:47

error​

error: "error";

Defined in: index.ts:48

info​

info: "info";

Defined in: index.ts:49

log​

log: "log";

Defined in: index.ts:50

success​

success: "success";

Defined in: index.ts:51

warn​

warn: "warn";

Defined in: index.ts:52


__internal​

const __internal: object;

Defined in: index.ts:212

Internal

Internal helpers exported for testing purposes only. Not part of the public API β€” do not use in application code.

Type Declaration​

hasLogMethod​

hasLogMethod: typeof hasLogMethod;

resolveLoggerInstance​

resolveLoggerInstance: typeof resolveLoggerInstance;

log()​

function log(message, level?): void;

Defined in: index.ts:198

Logs a message by calling the active logger instance.

Parameters​

message​

string

a string to be logged.

level?​

| "debug" | "error" | "info" | "log" | "success" | "warn" | LogLevel = LogLevel.info

optional log level, "info" by default.

Returns​

void

Remarks​

If a log level is not supported by the logger instance, then it defaults to "info".

Example​

import { log } from "@graphql-markdown/logger";

log("Info message"); // Expected console output "Info message"

Logger()​

function Logger(moduleName?): Promise<void>;

Defined in: index.ts:137

Instantiate a logger module. By default, the logger module uses globalThis.console

Parameters​

moduleName?​

string | Record<string, unknown>

optional name of the logger package, or a logger instance to use directly.

Returns​

Promise<void>

Example​

import Logger, { log } from "@graphql-markdown/logger";

log("Info message"); // Expected console output "Info message"

Logger("@docusaurus/logger");
log("Info message", "info"); // Expected Docusaurus log output "Info message"

Logger({ info: (message) => process.stdout.write(message) }); // Logger instance
log("Info message", "info"); // Expected custom logger output "Info message"

runtimeModuleSpecifier()​

function runtimeModuleSpecifier(name): string;

Defined in: index.ts:24

Internal

Resolves a module specifier for dynamic import() at runtime.

Parameters​

name​

string

the module specifier.

Returns​

string

the specifier to pass to import().

Remarks​

Inlined from runtimeModuleSpecifier in @graphql-markdown/utils (logger must not depend on utils). On Deno, bare specifiers are not resolved from inside a JSR package and need a prefix: @graphql-markdown/* names get jsr:, other bare names get npm:.