UNPKG

@creejs/commons-logging

Version:
107 lines (106 loc) 3.13 kB
export default LogLevel; declare namespace LogLevel { export { Name }; export { Level }; export { DefaultLevel }; export { hasLevel }; export { hasName }; export { assertLevel }; export { Name as LevelName }; export { Level as LevelValue }; export { value2Name }; export { name2Value }; } /** * * */ export type Name = string; export namespace Name { export { TRACE }; export { DEBUG }; export { INFO }; export { WARN }; export { ERROR }; export { FATAL }; export { OFF }; } /** * * */ export type Level = number; export namespace Level { let OFF_1: number; export { OFF_1 as OFF }; let FATAL_1: number; export { FATAL_1 as FATAL }; let ERROR_1: number; export { ERROR_1 as ERROR }; let WARN_1: number; export { WARN_1 as WARN }; let INFO_1: number; export { INFO_1 as INFO }; let DEBUG_1: number; export { DEBUG_1 as DEBUG }; let TRACE_1: number; export { TRACE_1 as TRACE }; export let ALL: number; } /** * The default logging level (ERROR) * @type {number} * @memberof LogLevel * @static */ export const DefaultLevel: number; /** * Checks if the given level is a valid log level. * @param {number} level - The log level to check. * @returns {boolean} True if the level is valid, false otherwise. * @memberof LogLevel * @static */ export function hasLevel(level: number): boolean; /** * Checks if the given level name exists in the Name enum/object. * @param {string} levelName - The name of the log level to check. * @returns {boolean} True if the level name exists, false otherwise. * @memberof LogLevel * @static */ export function hasName(levelName: string): boolean; /** * Validates that a given level is a number and falls within the valid range. * @param {*} level - The log level to validate * @throws {Error} If level is not a number or outside valid range (Level.OFF to Level.ALL) * @memberof LogLevel * @static */ export function assertLevel(level: any): void; /** * Converts a numeric logging level value to its corresponding name. * @param {number} value - The numeric logging level value to convert. * @returns {string|undefined} The name associated with the given logging level value, from {@link LogLevel.Name}. * @memberof LogLevel * @static */ export function value2Name(value: number): string | undefined; /** * Converts a logging level name to its corresponding numeric value. * @param {string} name - The name of the logging level. * @returns {number|undefined} The numeric value of the logging level from {@link LogLevel.Level}, or undefined if name is not supported. * @memberof LogLevel * @static */ export function name2Value(name: string): number | undefined; /** * @namespace LogLevel * @description Defines the logging levels and provides utilities for working with them. */ declare const TRACE: "TRACE"; declare const DEBUG: "DEBUG"; declare const INFO: "INFO"; declare const WARN: "WARN"; declare const ERROR: "ERROR"; declare const FATAL: "FATAL"; declare const OFF: "OFF"; export { Name as LevelName, Level as LevelValue };