@graphql-markdown/logger
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -30,3 +30,3 @@ /** | ||
* ```js | ||
* import { Logger, log } from "@graphql-markdown/utils/logger"; | ||
* import Logger, { log } from "@graphql-markdown/utils/logger"; | ||
* | ||
@@ -40,3 +40,3 @@ * log("Info message"); // Expected console output "Info message" | ||
*/ | ||
export declare const Logger: (moduleName?: string) => void; | ||
export declare const Logger: (moduleName?: string) => Promise<void>; | ||
/** | ||
@@ -43,0 +43,0 @@ * Logs a message by calling the active logger instance. |
@@ -7,2 +7,25 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -31,3 +54,3 @@ exports.log = exports.Logger = exports.LogLevel = void 0; | ||
* ```js | ||
* import { Logger, log } from "@graphql-markdown/utils/logger"; | ||
* import Logger, { log } from "@graphql-markdown/utils/logger"; | ||
* | ||
@@ -41,3 +64,3 @@ * log("Info message"); // Expected console output "Info message" | ||
*/ | ||
const Logger = (moduleName) => { | ||
const Logger = async (moduleName) => { | ||
if (global.logger?.instance && typeof moduleName === "undefined") { | ||
@@ -47,3 +70,3 @@ return; | ||
const instance = typeof moduleName === "string" && moduleName !== "" | ||
? require(moduleName) | ||
? (await Promise.resolve(`${moduleName}`).then(s => __importStar(require(s)))).default | ||
: global.console; | ||
@@ -76,3 +99,5 @@ const _log = (message, level = LogLevel.info) => { | ||
const log = (message, level = LogLevel.info) => { | ||
(0, exports.Logger)(); | ||
new Promise((resolve) => { | ||
resolve((0, exports.Logger)()); | ||
}).catch(() => { }); | ||
global.logger?._log(message, level); | ||
@@ -79,0 +104,0 @@ }; |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"license": "MIT", | ||
@@ -11,0 +11,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
8257
161