Skip to content

Commit

Permalink
🔧 build: 依赖更新
Browse files Browse the repository at this point in the history
  • Loading branch information
imsyy committed Jun 13, 2024
1 parent fa80a29 commit e6f89c4
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 87 deletions.
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
"license": "MIT",
"author": "imsyy",
"main": "dist/index.js",
"types": "src/types.d.ts",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"files": [
"LICENSE",
"README.md",
"dist/**/*",
"src/types.d.ts",
"!dist/logs/**/*"
],
"scripts": {
Expand All @@ -44,19 +42,19 @@
"dayjs": "^1.11.11",
"dotenv": "^16.4.5",
"feed": "^4.2.2",
"hono": "^4.4.3",
"hono": "^4.4.5",
"md5": "^2.3.0",
"node-cache": "^5.1.2",
"rss-parser": "^3.13.0",
"winston": "^3.13.0"
},
"devDependencies": {
"@types/node": "^20.14.1",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@typescript-eslint/parser": "^7.12.0",
"@types/node": "^20.14.2",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"prettier": "^3.3.0",
"prettier": "^3.3.2",
"tsx": "^3.14.0",
"typescript": "^5.4.5"
},
Expand Down
125 changes: 63 additions & 62 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 27 additions & 18 deletions src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ let pathOption: (typeof transports.File)[] = [];

// 日志输出目录
if (config.USE_LOG_FILE) {
pathOption = [
new transports.File({
filename: path.resolve("logs/error.log"),
level: "error",
maxsize: 1024 * 1024,
maxFiles: 1,
}),
new transports.File({
filename: path.resolve("logs/logger.log"),
maxsize: 1024 * 1024,
maxFiles: 1,
}),
];
try {
pathOption = [
new transports.File({
filename: path.resolve("logs/error.log"),
level: "error",
maxsize: 1024 * 1024,
maxFiles: 1,
}),
new transports.File({
filename: path.resolve("logs/logger.log"),
maxsize: 1024 * 1024,
maxFiles: 1,
}),
];
} catch (error) {
console.error("Failed to initialize log files. Logging to a file will be skipped.", error);
pathOption = [];
}
}

// logger
Expand All @@ -39,11 +44,15 @@ const logger = createLogger({

// 控制台输出
if (process.env.NODE_ENV !== "production") {
logger.add(
new transports.Console({
format: format.combine(format.colorize(), format.simple()),
}),
);
try {
logger.add(
new transports.Console({
format: format.combine(format.colorize(), format.simple()),
}),
);
} catch (error) {
console.error("Failed to add console transport. Console logging will be skipped.", error);
}
}

export default logger;

0 comments on commit e6f89c4

Please sign in to comment.