chore: 更新.gitignore并添加新文件

在.gitignore中添加对*.png、*.log、*-lock.json、*.woff2文件的忽略规则,并新增OFL.txt文件。同时,添加vue.svg图标文件以支持前端展示。更新多个TypeScript文件以优化代码格式和增强可读性。
This commit is contained in:
dmy
2026-01-14 22:26:32 +08:00
parent 10565af001
commit 82f5a81887
47 changed files with 1513 additions and 814 deletions

View File

@@ -16,13 +16,33 @@ const logFormat = winston.format.combine(
winston.format.errors({ stack: true }),
winston.format.splat(),
winston.format.printf(({ timestamp, level, message, context, stack }) => {
let log = `${timestamp} [${level}]`;
if (context) {
log += ` [${context}]`;
}
log += ` ${message}`;
const timestampStr =
typeof timestamp === 'string' ? timestamp : String(timestamp);
const levelStr = typeof level === 'string' ? level : String(level);
const messageStr = typeof message === 'string' ? message : String(message);
const contextStr = context
? typeof context === 'string'
? context
: JSON.stringify(context)
: '';
let stackStr = '';
if (stack) {
log += `\n${stack}`;
if (typeof stack === 'string') {
stackStr = stack;
} else if (typeof stack === 'object' && stack !== null) {
stackStr = JSON.stringify(stack);
} else {
stackStr = String(stack);
}
}
let log = `${timestampStr} [${levelStr}]`;
if (contextStr) {
log += ` [${contextStr}]`;
}
log += ` ${messageStr}`;
if (stackStr) {
log += `\n${stackStr}`;
}
return log;
}),
@@ -30,10 +50,7 @@ const logFormat = winston.format.combine(
// 控制台传输
const consoleTransport = new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
logFormat,
),
format: winston.format.combine(winston.format.colorize(), logFormat),
});
// 应用日志传输(按天轮转)
@@ -61,10 +78,6 @@ const errorLogTransport = new DailyRotateFile({
export const winstonLogger = winston.createLogger({
level: process.env.LOG_LEVEL || 'info',
format: logFormat,
transports: [
consoleTransport,
appLogTransport,
errorLogTransport,
],
transports: [consoleTransport, appLogTransport, errorLogTransport],
exitOnError: false,
});