@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
79 lines • 2.49 kB
JavaScript
export 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 || (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.
*/
export 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.
*/
export 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.
*/
export 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.
*/
export 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.
*/
export 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.
*/
export 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.
*/
export 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.
*/
export function logGroupEnd() {
if (logLevel <= LogLevel.Info) {
console.groupEnd();
}
}
//# sourceMappingURL=Logger.js.map