feat logging: Implement LOG_LEVEL configuration option and improve logging consistency

- Add LOG_LEVEL configuration option to control logging verbosity
- Update UI to include LOG_LEVEL dropdown in settings
- Fix logging inconsistency between environment variables and config file
- Unify logging configuration to use config file settings
- Maintain separate logging systems for different purposes:
  * Server-level logs (HTTP requests, API calls) using pino in ~/.claude-code-router/logs/
  * Application-level logs (routing decisions, business logic) in ~/.claude-code-router/claude-code-router.log
- Update documentation with accurate logging system information
- Add detailed information about dual logging systems in README.md and README_zh.md
- Improve type safety and validation in ConfigProvider

Co-authored-by: qwen-cli <https://github.com/QwenLM/qwen-code>
This commit is contained in:
BigUncle
2025-08-13 22:10:52 +08:00
parent a62a025368
commit b8f52ba538
11 changed files with 66 additions and 15 deletions

View File

@@ -11,6 +11,7 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
import { Combobox } from "@/components/ui/combobox";
import { useConfig } from "./ConfigProvider";
interface SettingsDialogProps {
@@ -45,6 +46,21 @@ export function SettingsDialog({ isOpen, onOpenChange }: SettingsDialogProps) {
<Switch id="log" checked={config.LOG} onCheckedChange={handleLogChange} />
<Label htmlFor="log" className="transition-all-ease hover:scale-[1.02] cursor-pointer">{t("toplevel.log")}</Label>
</div>
<div className="space-y-2">
<Label htmlFor="log-level" className="transition-all-ease hover:scale-[1.01] cursor-pointer">{t("toplevel.log_level")}</Label>
<Combobox
options={[
{ label: "fatal", value: "fatal" },
{ label: "error", value: "error" },
{ label: "warn", value: "warn" },
{ label: "info", value: "info" },
{ label: "debug", value: "debug" },
{ label: "trace", value: "trace" },
]}
value={config.LOG_LEVEL}
onChange={(value) => setConfig({ ...config, LOG_LEVEL: value })}
/>
</div>
<div className="space-y-2">
<Label htmlFor="claude-path" className="transition-all-ease hover:scale-[1.01] cursor-pointer">{t("toplevel.claude_path")}</Label>
<Input id="claude-path" value={config.CLAUDE_PATH} onChange={handlePathChange} className="transition-all-ease focus:scale-[1.01]" />