-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[INLONG-8791][TubeMQ] Tubemq-client-go lacks log level configuration API #8793
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,3 +39,18 @@ var defaultConfig = &OutputConfig{ | |
MaxAge: 3, | ||
Level: "warn", | ||
} | ||
|
||
// SetLogLevel set log level | ||
func SetLogLevel(level string) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to check whether the set value is legal and valid |
||
defaultConfig.Level = level | ||
} | ||
|
||
// SetLogPath set log path | ||
func SetLogPath(path string) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is necessary to check that the path allowed to be set is legal, and it may be necessary to check whether there is permission to output the log |
||
defaultConfig.LogPath = path | ||
} | ||
|
||
// GetLogConfig get log config | ||
func GetLogConfig() *OutputConfig { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not appropriate to directly expose objects for external settings. It is best to add methods to operate, and then add validity checks to the set values in the methods |
||
return defaultConfig | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should we do if multiple consumers set Log information and the set values are inconsistent?
I personally think that the setting of the log service should be a separate operation and should not be bound to the Consumer object