gosonzhang commented on code in PR #8793:
URL: https://github.com/apache/inlong/pull/8793#discussion_r1303947305
##########
inlong-tubemq/tubemq-client-twins/tubemq-client-go/client/consumer_impl.go:
##########
@@ -77,6 +77,10 @@ func NewConsumer(config *config.Config) (Consumer, error) {
if err := config.ValidateConsumer(); err != nil {
return nil, err
}
+ log.SetLogLevel(config.Log.LogLevel)
Review Comment:
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
##########
inlong-tubemq/tubemq-client-twins/tubemq-client-go/log/config.go:
##########
@@ -39,3 +39,18 @@ var defaultConfig = &OutputConfig{
MaxAge: 3,
Level: "warn",
}
+
+// SetLogLevel set log level
+func SetLogLevel(level string) {
Review Comment:
Need to check whether the set value is legal and valid
##########
inlong-tubemq/tubemq-client-twins/tubemq-client-go/log/config.go:
##########
@@ -39,3 +39,18 @@ var defaultConfig = &OutputConfig{
MaxAge: 3,
Level: "warn",
}
+
+// SetLogLevel set log level
+func SetLogLevel(level string) {
+ defaultConfig.Level = level
+}
+
+// SetLogPath set log path
+func SetLogPath(path string) {
Review Comment:
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
##########
inlong-tubemq/tubemq-client-twins/tubemq-client-go/log/config.go:
##########
@@ -39,3 +39,18 @@ var defaultConfig = &OutputConfig{
MaxAge: 3,
Level: "warn",
}
+
+// SetLogLevel set log level
+func SetLogLevel(level string) {
+ defaultConfig.Level = level
+}
+
+// SetLogPath set log path
+func SetLogPath(path string) {
+ defaultConfig.LogPath = path
+}
+
+// GetLogConfig get log config
+func GetLogConfig() *OutputConfig {
Review Comment:
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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]