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:.