| 123456789101112131415161718192021222324252627282930313233343536373839 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.LoggerService = void 0;
- const systemLog_1 = require("../models/systemLog");
- class LoggerService {
- static async info(message, options) {
- return this.log('info', message, options);
- }
- static async warn(message, options) {
- return this.log('warn', message, options);
- }
- static async error(message, options) {
- return this.log('error', message, options);
- }
- static async debug(message, options) {
- return this.log('debug', message, options);
- }
- static async log(level, message, options) {
- try {
- const logData = {
- level,
- message,
- source: options.source,
- module: options.module || 'general',
- user_id: options.user_id,
- username: options.username,
- ip_address: options.ip_address,
- details: options.details
- };
- return await systemLog_1.SystemLogModel.create(logData);
- }
- catch (error) {
- console.error('日志写入失败:', error);
- return null;
- }
- }
- }
- exports.LoggerService = LoggerService;
- //# sourceMappingURL=loggerService.js.map
|