@uisap/core
Version:
A modular Fastify-based framework inspired by Laravel
28 lines (25 loc) • 656 B
JavaScript
export class Command {
constructor(fastify) {
this.fastify = fastify;
this.app = fastify.app;
this.signature = "";
this.description = "";
}
async handle(...args) {
throw new Error("Handle method must be implemented");
}
async execute(...args) {
try {
this.fastify.logger.info(`Komut çalıştırılıyor: ${this.signature}`, {
args,
});
await this.handle(...args);
this.fastify.logger.info(`Komut tamamlandı: ${this.signature}`);
} catch (err) {
this.fastify.logger.error(`Komut hatası: ${this.signature}`, {
error: err.message,
});
throw err;
}
}
}