zyf-server
Version:
A modern HTTP static file server with Vue SSR directory listing, built for developers
33 lines • 1.08 kB
JavaScript
;
/**
* 简单的日志工具类
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
const chalk_1 = __importDefault(require("chalk"));
const debug_1 = __importDefault(require("debug"));
class Logger {
debugger;
namespace;
constructor(namespace) {
this.namespace = namespace;
this.debugger = (0, debug_1.default)(`zyf-server:${namespace}`);
}
info(message, ...args) {
console.log(chalk_1.default.blue(`[${this.namespace}]`), message, ...args);
}
warn(message, ...args) {
console.warn(chalk_1.default.yellow(`[${this.namespace}] WARN:`), message, ...args);
}
error(message, ...args) {
console.error(chalk_1.default.red(`[${this.namespace}] ERROR:`), message, ...args);
}
debug(message, ...args) {
this.debugger(message, ...args);
}
}
exports.Logger = Logger;
//# sourceMappingURL=Logger.js.map