@hadss/hmrouter-plugin
Version:
HMRouter Compiler Plugin
32 lines (31 loc) • 1.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
const hvigor_1 = require("@ohos/hvigor");
class Logger {
static error(module, msg, ...args) {
const prefix = `[HMRouterPlugin][${module}]:`;
hvigor_1.HvigorLogger.getLogger().error(`${prefix} ${msg}`, ...args);
}
static info(module, msg, ...args) {
const prefix = `[HMRouterPlugin][${module}]:`;
hvigor_1.HvigorLogger.getLogger().info(`${prefix} ${msg}`, ...args);
}
static warn(module, msg, ...args) {
const prefix = `[HMRouterPlugin][${module}]:`;
hvigor_1.HvigorLogger.getLogger().warn(`${prefix} ${msg}`, ...args);
}
static debug(module, msg, ...args) {
const prefix = `[HMRouterPlugin][${module}]:`;
hvigor_1.HvigorLogger.getLogger().debug(`${prefix} ${msg}`, ...args);
}
static withContext(module, operation) {
return {
error: (msg, ...args) => Logger.error(module, `${operation} - ${msg}`, ...args),
info: (msg, ...args) => Logger.info(module, `${operation} - ${msg}`, ...args),
warn: (msg, ...args) => Logger.warn(module, `${operation} - ${msg}`, ...args),
debug: (msg, ...args) => Logger.debug(module, `${operation} - ${msg}`, ...args),
};
}
}
exports.Logger = Logger;