feat: add logging enhancements and listen address flag for SSE mode#11
Merged
feat: add logging enhancements and listen address flag for SSE mode#11
Conversation
Signed-off-by: cfc4n <cfc4n.cs@gmail.com>
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the logging functionality and server initialization process while introducing a new persistent flag for specifying the listen address for SSE mode.
- Updates logging in the Serve method with zerolog for detailed startup messages and warnings.
- Introduces a new persistent flag "listen_addr" to switch between STDIO and SSE modes.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cli/cmd/root.go | Adds the persistent flag "listen_addr" for SSE mode configuration. |
| cli/cmd/moling.go | Updates the Serve method for enhanced logging and SSE server setup. |
Comments suppressed due to low confidence (2)
cli/cmd/moling.go:100
- Consider using strings.TrimPrefix instead of strings.Trim to remove the "http://" prefix from s.listenAddr. Using strings.Trim may remove unintended characters.
ltnAddr := fmt.Sprintf("http://%s", strings.Trim(s.listenAddr, "http://"))
cli/cmd/root.go:129
- [nitpick] The flag description is unclear; consider rewording it to something like: 'Listen address for SSE mode. If empty, STDIO mode will be used.'
rootCmd.PersistentFlags().StringVarP(&mlConfig.ListenAddr, "listen_addr", "l", "", "listen address for SSE mode. default:'', not listen, used STDIO mode.")
… code formatting step Signed-off-by: cfc4n <cfc4n.cs@gmail.com>
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 includes several changes to the
cli/cmdpackage, focusing on enhancing logging, server initialization, and command-line flag handling. The most significant changes are the addition of new imports, updates to theServemethod to improve logging and server setup, and the introduction of a new command-line flag for specifying the listen address.Improvements to logging and server setup:
cli/cmd/moling.go: Added new imports forfmt,os,strings, andtimeto support enhanced logging and server setup.cli/cmd/moling.go: Updated theServemethod inMoLingServerto usezerologfor improved logging, including detailed startup messages and warnings about the SSE server URL.Command-line flag handling:
cli/cmd/root.go: Added a new persistent flaglisten_addrto specify the listen address for SSE mode, with a default value of an empty string indicating the use of STDIO mode.