@kontent-ai/smart-link
Version:
Kontent.ai Smart Link SDK allowing to automatically inject [smart links](https://docs.kontent.ai/tutorials/develop-apps/build-strong-foundation/set-up-editing-from-preview#a-using-smart-links) to Kontent.ai according to manually specified [HTML data attri
90 lines • 2.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogLevel = void 0;
exports.setLogLevel = setLogLevel;
exports.logError = logError;
exports.logWarn = logWarn;
exports.logInfo = logInfo;
exports.logDebug = logDebug;
exports.logGroupCollapsed = logGroupCollapsed;
exports.logGroup = logGroup;
exports.logGroupEnd = logGroupEnd;
var LogLevel;
(function (LogLevel) {
LogLevel[LogLevel["Debug"] = 1] = "Debug";
LogLevel[LogLevel["Info"] = 2] = "Info";
LogLevel[LogLevel["Warn"] = 3] = "Warn";
LogLevel[LogLevel["Error"] = 4] = "Error";
})(LogLevel || (exports.LogLevel = LogLevel = {}));
let logLevel = LogLevel.Info;
/**
* Sets the global log level for all logging functions.
* Note: This function is impure as it modifies the module-scoped logLevel variable.
*/
function setLogLevel(level) {
logLevel = level;
}
/**
* Logs error messages to the console with '[KSL][Error]:' prefix.
* Note: This function is impure as it depends on the module-scoped logLevel variable.
*/
function logError(...args) {
if (logLevel <= LogLevel.Error) {
console.error('[KSL][Error]: ', ...args);
}
}
/**
* Logs warning messages to the console with '[KSL][Warning]:' prefix.
* Note: This function is impure as it depends on the module-scoped logLevel variable.
*/
function logWarn(...args) {
if (logLevel <= LogLevel.Warn) {
console.warn('[KSL][Warning]: ', ...args);
}
}
/**
* Logs informational messages to the console with '[KSL][Info]:' prefix.
* Note: This function is impure as it depends on the module-scoped logLevel variable.
*/
function logInfo(...args) {
if (logLevel <= LogLevel.Info) {
console.info('[KSL][Info]: ', ...args);
}
}
/**
* Logs debug messages to the console.
* Note: This function is impure as it depends on the module-scoped logLevel variable.
*/
function logDebug(...args) {
if (logLevel <= LogLevel.Debug) {
console.log(`[KSL][Debug]: `, ...args);
}
}
/**
* Creates a collapsed console group for debug logging.
* Note: This function is impure as it depends on the module-scoped logLevel variable.
*/
function logGroupCollapsed(...args) {
if (logLevel <= LogLevel.Info) {
console.groupCollapsed(...args);
}
}
/**
* Creates an expanded console group for debug logging.
* Note: This function is impure as it depends on the module-scoped logLevel variable.
*/
function logGroup(...args) {
if (logLevel <= LogLevel.Info) {
console.group(...args);
}
}
/**
* Ends the current console group for debug logging.
* Note: This function is impure as it depends on the module-scoped logLevel variable.
*/
function logGroupEnd() {
if (logLevel <= LogLevel.Info) {
console.groupEnd();
}
}
//# sourceMappingURL=Logger.js.map