feat: implement log file rotation and enhance logging configuration#14
Merged
feat: implement log file rotation and enhance logging configuration#14
Conversation
Signed-off-by: cfc4n <cfc4n.cs@gmail.com>
There was a problem hiding this comment.
Pull Request Overview
This PR implements log file rotation and enhances logging configuration while also updating browser-related timeout settings and minor configuration improvements. Key changes include:
- Introducing a RotateWriter in utils/rotewriter.go for log rotation.
- Replacing CSSTimeout with SelectorQueryTimeout across browser config and related functions.
- Updating logging initialization in cli/cmd/root.go with the new RotateWriter and log rotation constants.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| utils/rotewriter.go | New log rotation implementation using RotateWriter. |
| services/file_system_config.go | Trim whitespace from allowed directory paths. |
| services/browser_test.go | Updated comments to reflect the renamed timeout parameter. |
| services/browser_config.go | Renamed CSSTimeout to SelectorQueryTimeout and updated messages. |
| services/browser.go | Updated browser tool configuration and added prompt handling. |
| cli/cmd/root.go | Updated logger initialization to use RotateWriter and log file constants. |
Comments suppressed due to low confidence (2)
cli/cmd/root.go:168
- [nitpick] The variable name 'loger' appears to be a typo; consider renaming it to 'logger' for consistency.
loger.Info().Str("ServerName", MCPServerName).Str("version", GitVersion).Msg("start")
services/browser_config.go:47
- [nitpick] Consider updating the error message to use consistent capitalization, e.g., 'Selector query timeout must be greater than 0'.
return fmt.Errorf("selector Query timeout must be greater than 0")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request focuses on enhancing the logging mechanism, updating browser server functionalities, and refining configuration settings.
Logging Enhancements:
utilsincli/cmd/root.goto support the new logging functionality.LogFileNameandMaxLogSizeconstants for log file management incli/cmd/root.go.initLoggerfunction to useRotateWriterfor log rotation based on the defined size threshold.mlsCommandFunc. [1] [2]Browser Server Updates:
timeinservices/browser.goto handle timeout configurations.CommandLineFlagSecurityWarningsEnabledto the browser server initialization to disable security warnings.PromptEntryfor handling browser prompts inservices/browser.go.handlePromptmethod to process browser prompts.handleClickandhandleFillmethods to use a timeout context for selector queries. [1] [2]Configuration Refinements:
CSSTimeouttoSelectorQueryTimeoutinservices/browser_config.goto better reflect its purpose. [1] [2] [3]services/browser_test.go.Utility Additions:
RotateWriterutility inutils/rotewriter.goto handle log rotation based on file size.These changes collectively improve the logging system, enhance browser server functionalities, and refine configuration settings for better clarity and performance.