@creejs/commons-logging
Version:
Common Utils About Logging
55 lines (54 loc) • 1.99 kB
TypeScript
/**
* @abstract
*/
export default class LogFactory {
/**
* Checks if a value resembles a LogFactory by verifying it has required methods.
* @param {*} value - The value to check
* @returns {boolean}
*/
static isLogFactoryLike(value: any): boolean;
/**
* Asserts that the given value is a valid LogFactory-Like object.
* @throws {Error} Throws an error if the value is not LogFactory-Like
* @param {*} value - The value to check.
*/
static assertLogFactoryLike(value: any): void;
/**
* Creates a new logging provider instance.
* @param {{}} libraryModule - the library module
* @param {{}} setting - Configuration settings for the provider
*/
constructor(libraryModule: {}, setting: {});
_libraryModule: {};
_setting: {};
get libraryModule(): {};
get setting(): {};
/**
* Initializes the logging provider.
* 1. Do nothing in the default implementation.
* 2. Override this method to initialize the provider.
* @returns {Promise<void>|void}
*/
init(): Promise<void> | void;
/**
* Update factory's Log Level
* 1. Only Provider knows how to update
* * update level in "setting", so the new created Logger will use the new level
* 2. called when users want to change global log level via CommonsLogging.setLevel()
* @param {number} level - The log level to set, see {@link LogLevel.Level}
* @returns {void}
* @throws {Error} Throws an error as this method is Not Impled Yet.
* @abstract
*/
setLevel(level: number): void;
/**
* Creates a new logger named with the "loggerName"
* @param {string} loggerName - The name to associate with the logger instance.
* @throws {Error} Throws an error indicating the method is Not Impled Yet yet.
* @returns {Logger} A new logger intance
* @abstract
*/
createLogger(loggerName: string): Logger;
}
import Logger from './logger.js';