@graphql-markdown/logger
Logger singleton module.
LogLevel
Defined in: logger/src/index.ts:31
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: logger/src/index.ts:32
error
error: "error";
Defined in: logger/src/index.ts:33
info
info: "info";
Defined in: logger/src/index.ts:34
log
log: "log";
Defined in: logger/src/index.ts:35
success
success: "success";
Defined in: logger/src/index.ts:36
warn
warn: "warn";
Defined in: logger/src/index.ts:37
__internal
const __internal: object;
Defined in: logger/src/index.ts:197
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;
runtimeModuleSpecifier
const runtimeModuleSpecifier: (name, range?) => string;
Defined in: utils/dist/module.d.ts:28
Resolves a module specifier for dynamic import() at runtime.
A relative path (./ or ../) is resolved from the current working directory and returned
as a file: URL. import() would otherwise resolve it from the importing module, a file
inside the installed package, so a path set in the user's configuration would not be found.
Node.js and Bun resolve bare names from node_modules, but Deno does not resolve them from
inside a JSR package. On Deno, @graphql-markdown/* names are prefixed with jsr: and other
bare names with npm:. Absolute, URL and already prefixed specifiers are untouched.
Parameters
name
string
the module specifier.
range?
string
optional version range inserted after the package name (e.g. ^3.8.3).
Returns
string
the specifier to pass to import().
Example
runtimeModuleSpecifier("prettier", "^3.8.3"); // Deno: "npm:prettier@^3.8.3", else "prettier"
runtimeModuleSpecifier("./lib/custom-mdx.cjs"); // "file:///<cwd>/lib/custom-mdx.cjs"
log()
function log(message, level?): void;
Defined in: logger/src/index.ts:183
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: logger/src/index.ts:122
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"