Commit Graph

21 Commits

Author SHA1 Message Date
hkfires
d16599fa1d feat: prefer util.WritablePath() for logs and local storage 2025-10-19 10:19:55 +08:00
hkfires
9f45806106 feat(logging): centralize sensitive header masking 2025-10-18 17:16:00 +08:00
Luis Pater
3dd0844b98 Enhance logging for API requests and responses across executors
- Added detailed logging of upstream request metadata including URL, method, headers, and body for Codex, Gemini, IFlow, OpenAI Compat, and Qwen executors.
- Implemented error logging for API response failures to capture errors during HTTP requests.
- Introduced structured logging for authentication details (AuthID, AuthLabel, AuthType, AuthValue) to improve traceability.
- Updated response logging to include status codes and headers for better debugging.
- Ensured that all executors consistently log API interactions to facilitate monitoring and troubleshooting.
2025-10-17 04:12:38 +08:00
Luis Pater
cf734f7e7b feat(logging): introduce centralized logging with custom format and Gin integration
- Implemented a global logger with structured formatting for consistent log output.
- Added support for rotating log files using Lumberjack.
- Integrated new logging functionality with Gin HTTP server for unified log handling.
- Replaced direct `log.Info` calls with `fmt.Printf` in non-critical paths to simplify core functionality.
2025-09-26 00:54:52 +08:00
Luis Pater
f5dc380b63 rebuild branch 2025-09-25 10:32:48 +08:00
Luis Pater
3f69254f43 remove all 2025-09-25 10:31:02 +08:00
Luis Pater
ac93641946 refactor(logging, mgmt): update timestamp format in logs and remove force-gpt-5-codex handlers
- Changed log timestamp format in `request_logger.go` to align with ISO standards for improved readability.
- Removed deprecated `force-gpt-5-codex` handlers from management API.
2025-09-25 08:27:53 +08:00
Luis Pater
0db0b03db9 chore(docs): add and refine package-level comments across modules
- Added detailed package-level comments to improve documentation coverage.
- Clarified parameter descriptions, return types, and functionality of exported methods across packages.
- Enhanced overall code readability and API documentation consistency.
2025-09-25 00:14:17 +08:00
Luis Pater
f1c4caf14a feat(logging): integrate logrus with custom Gin middleware for enhanced request logging and recovery
- Added `GinLogrusLogger` for structured request logging using Logrus.
- Implemented `GinLogrusRecovery` to handle panics and log stack traces.
- Configured log rotation using Lumberjack for efficient log management.
- Replaced Gin's default logger and recovery middleware with the custom implementations.
2025-09-22 22:17:12 +08:00
hkfires
22a69333a0 feat(gemini-web): Implement proactive PSIDTS cookie rotation 2025-09-22 21:54:52 +08:00
hkfires
314125e7ec fix(logging): Prevent race conditions in FileStreamingLogWriter 2025-09-22 16:46:01 +08:00
Luis Pater
4999fce7f4 v6 version first commit 2025-09-22 01:40:24 +08:00
Luis Pater
9fce13fe03 Update internal module imports to use v5 package path
- Updated all `github.com/luispater/CLIProxyAPI/internal/...` imports to point to `github.com/luispater/CLIProxyAPI/v5/internal/...`.
- Adjusted `go.mod` to specify `module github.com/luispater/CLIProxyAPI/v5`.
2025-09-13 23:34:32 +08:00
Luis Pater
4375822cbb Resolve logsDir path relative to configuration directory in FileRequestLogger 2025-09-12 15:28:07 +08:00
Luis Pater
4e67cd4baf Resolve relative logsDir to executable directory in FileRequestLogger 2025-09-10 03:15:58 +08:00
Luis Pater
ad943b2d4d Add reverse mappings for original tool names and improve error logging
- Introduced reverse mapping logic for tool names in translators to restore original names when shortened.
- Enhanced error handling by logging API response errors consistently across handlers.
- Refactored request and response loggers to include API error details, improving debugging capabilities.
- Integrated robust tool name shortening and uniqueness mechanisms for OpenAI, Gemini, and Claude requests.
- Improved handler retry logic to properly capture and respond to errors.
2025-09-04 02:39:56 +08:00
Luis Pater
9102ff031d Refactor API handlers to implement retry mechanism with configurable limits and improved error handling
- Introduced retry counter with a configurable ` RequestRetry ` limit in all handlers.
- Enhanced error handling with specific HTTP status codes for switching clients.
- Standardized response forwarding for non-retriable errors.
- Improved logging for quota and client switch scenarios.
2025-08-25 23:43:49 +08:00
Luis Pater
8c555c4e69 Refactor codebase 2025-08-25 16:58:16 +08:00
Luis Pater
c5cc238308 Refactor error handling and variable declarations in browser and logging modules
- Simplified variable initialization in `browser.go` for readability.
- Updated error handling in `request_logger.go` with better resource cleanup using deferred anonymous functions.

Refactor API handlers to use `GetContextWithCancel` for streamlined context creation and response handling

- Replaced redundant `context.WithCancel` and `context.WithValue` logic with the new `GetContextWithCancel` utility in all handlers.
- Centralized API response storage in the given context during cancellation.
- Updated associated cancellation calls for consistency and improved resource management.

- Replaced `apiResponseData` with `AddAPIResponseData` for centralized response recording.
- Simplified cancellation logic by switching to a boolean-based `cliCancel` method.
- Removed unused `apiResponseData` slices across handlers to reduce memory usage.
- Updated `handlers.go` to support unified response data storage per request context.
2025-08-17 20:13:45 +08:00
Luis Pater
fcadf08921 Add request logging capabilities to API handlers and update .gitignore
Enhance API response handling by storing responses in context and updating request logger to include API responses
2025-08-16 06:09:04 +08:00
Luis Pater
de7b8501cc Add openai codex support 2025-08-16 01:22:33 +08:00