Files
bun-app-template/config.schema.json
lanyuanxiaoyao 60d50afad1 feat: 引入运行时日志体系和存储配置,配置文件改为必填
- 新增 pino/pino-pretty/pino-roll 依赖,实现结构化日志(console pretty + file JSONL rolling)
- 新增 Logger 接口及 PinoLoggerWrapper/ConsoleFallbackLogger/NoopLogger/MemoryLogger 实现
- 新增 src/pino-roll.d.ts 类型声明
- 新增 server.storage.dataDir 配置(默认 ./data,相对路径基于配置文件目录)
- 新增 server.logging 配置(level/console/file/rotation,支持变量引用)
- 配置文件从可选改为必填,parseRuntimeArgs 无参数时抛错
- bootstrap 创建 logger、确保 dataDir、shutdown flush、失败路径 fallback
- startServer 接收 logger 并输出结构化监听日志
- ESLint 新增 no-restricted-syntax 禁止 src/server 直接 console.*(排除 logger.ts)
- 更新 config.example.yaml、README.md、DEVELOPMENT.md 同步配置和日志文档
- 完善测试覆盖:logger、config、schema、bootstrap 共 150 个测试通过
2026-05-25 14:44:37 +08:00

255 lines
7.2 KiB
JSON

{
"additionalProperties": false,
"type": "object",
"properties": {
"server": {
"additionalProperties": false,
"type": "object",
"properties": {
"listen": {
"additionalProperties": false,
"type": "object",
"properties": {
"host": {
"type": "string"
},
"port": {
"anyOf": [
{
"maximum": 65535,
"minimum": 0,
"type": "integer"
},
{
"pattern": "^\\$\\{[^}]+\\}$",
"type": "string"
}
]
}
}
},
"logging": {
"additionalProperties": false,
"type": "object",
"properties": {
"console": {
"additionalProperties": false,
"type": "object",
"properties": {
"level": {
"anyOf": [
{
"anyOf": [
{
"const": "trace",
"type": "string"
},
{
"const": "debug",
"type": "string"
},
{
"const": "info",
"type": "string"
},
{
"const": "warn",
"type": "string"
},
{
"const": "error",
"type": "string"
},
{
"const": "fatal",
"type": "string"
}
]
},
{
"pattern": "^\\$\\{[^}]+\\}$",
"type": "string"
}
]
}
}
},
"file": {
"additionalProperties": false,
"type": "object",
"properties": {
"level": {
"anyOf": [
{
"anyOf": [
{
"const": "trace",
"type": "string"
},
{
"const": "debug",
"type": "string"
},
{
"const": "info",
"type": "string"
},
{
"const": "warn",
"type": "string"
},
{
"const": "error",
"type": "string"
},
{
"const": "fatal",
"type": "string"
}
]
},
{
"pattern": "^\\$\\{[^}]+\\}$",
"type": "string"
}
]
},
"path": {
"minLength": 1,
"type": "string"
},
"rotation": {
"additionalProperties": false,
"type": "object",
"properties": {
"frequency": {
"anyOf": [
{
"anyOf": [
{
"const": "hourly",
"type": "string"
},
{
"const": "daily",
"type": "string"
},
{
"const": "weekly",
"type": "string"
}
]
},
{
"pattern": "^\\$\\{[^}]+\\}$",
"type": "string"
}
]
},
"maxFiles": {
"anyOf": [
{
"minimum": 1,
"type": "integer"
},
{
"pattern": "^\\$\\{[^}]+\\}$",
"type": "string"
}
]
},
"size": {
"anyOf": [
{
"anyOf": [
{
"type": "string"
},
{
"minimum": 0,
"type": "integer"
}
]
},
{
"pattern": "^\\$\\{[^}]+\\}$",
"type": "string"
}
]
}
}
}
}
},
"level": {
"anyOf": [
{
"anyOf": [
{
"const": "trace",
"type": "string"
},
{
"const": "debug",
"type": "string"
},
{
"const": "info",
"type": "string"
},
{
"const": "warn",
"type": "string"
},
{
"const": "error",
"type": "string"
},
{
"const": "fatal",
"type": "string"
}
]
},
{
"pattern": "^\\$\\{[^}]+\\}$",
"type": "string"
}
]
}
}
},
"storage": {
"additionalProperties": false,
"type": "object",
"properties": {
"dataDir": {
"type": "string"
}
}
}
}
},
"variables": {
"type": "object",
"patternProperties": {
"^[a-zA-Z_][a-zA-Z0-9_]*$": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
}
]
}
}
}
},
"$id": "https://app.local/config.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#"
}