mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 16:43:35 +00:00
feat: 支持通过 LOG_LEVEL 环境变量动态设置日志级别
- 允许在不修改配置文件的情况下调整日志级别 - 便于生产环境调试和故障排查 - 环境变量优先级高于配置文件
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
[](https://nodejs.org/)
|
[](https://nodejs.org/)
|
||||||
[](https://redis.io/)
|
[](https://redis.io/)
|
||||||
[](https://www.docker.com/)
|
[](https://www.docker.com/)
|
||||||
[](https://github.com/Wei-Shaw/claude-relay-service/actions/workflows/docker-publish.yml)
|
[](https://github.com/Wei-Shaw/claude-relay-service/actions/workflows/auto-release-pipeline.yml)
|
||||||
[](https://hub.docker.com/r/weishaw/claude-relay-service)
|
[](https://hub.docker.com/r/weishaw/claude-relay-service)
|
||||||
|
|
||||||
**🔐 自行搭建Claude API中转服务,支持多账户管理**
|
**🔐 自行搭建Claude API中转服务,支持多账户管理**
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ const securityLogger = winston.createLogger({
|
|||||||
|
|
||||||
// 🌟 增强的 Winston logger
|
// 🌟 增强的 Winston logger
|
||||||
const logger = winston.createLogger({
|
const logger = winston.createLogger({
|
||||||
level: config.logging.level,
|
level: process.env.LOG_LEVEL || config.logging.level,
|
||||||
format: logFormat,
|
format: logFormat,
|
||||||
transports: [
|
transports: [
|
||||||
// 📄 文件输出
|
// 📄 文件输出
|
||||||
@@ -282,10 +282,11 @@ logger.healthCheck = () => {
|
|||||||
|
|
||||||
// 🎬 启动日志记录系统
|
// 🎬 启动日志记录系统
|
||||||
logger.start('Logger initialized', {
|
logger.start('Logger initialized', {
|
||||||
level: config.logging.level,
|
level: process.env.LOG_LEVEL || config.logging.level,
|
||||||
directory: config.logging.dirname,
|
directory: config.logging.dirname,
|
||||||
maxSize: config.logging.maxSize,
|
maxSize: config.logging.maxSize,
|
||||||
maxFiles: config.logging.maxFiles
|
maxFiles: config.logging.maxFiles,
|
||||||
|
envOverride: process.env.LOG_LEVEL ? true : false
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = logger;
|
module.exports = logger;
|
||||||
Reference in New Issue
Block a user