lvanneo commented on code in PR #10040:
URL: https://github.com/apache/inlong/pull/10040#discussion_r1574059080


##########
inlong-tubemq/tubemq-client-twins/tubemq-client-go/log/config.go:
##########
@@ -39,3 +44,40 @@ var defaultConfig = &OutputConfig{
        MaxAge:     3,
        Level:      "warn",
 }
+
+// SetLogLevel set log level
+func SetLogLevel(level string) error {
+       if _, exist := LevelNames[level]; !exist {
+               return errors.New("the supported log levels are: trace, debug, 
info, warn, error, fatal. Please check your log level")
+       }
+       defaultConfig.Level = level
+       return nil
+}
+
+// SetLogPath set log path
+func SetLogPath(path string) error {
+       err := isValidLogPath(path)
+       if err != nil {
+               return err
+       }
+       defaultConfig.LogPath = path
+       return nil
+}
+func isValidLogPath(path string) error {

Review Comment:
   It is recommended to leave a blank line before the method.



##########
inlong-tubemq/tubemq-client-twins/tubemq-client-go/log/config.go:
##########
@@ -39,3 +44,40 @@ var defaultConfig = &OutputConfig{
        MaxAge:     3,
        Level:      "warn",
 }
+
+// SetLogLevel set log level
+func SetLogLevel(level string) error {
+       if _, exist := LevelNames[level]; !exist {
+               return errors.New("the supported log levels are: trace, debug, 
info, warn, error, fatal. Please check your log level")
+       }
+       defaultConfig.Level = level
+       return nil
+}
+
+// SetLogPath set log path
+func SetLogPath(path string) error {
+       err := isValidLogPath(path)
+       if err != nil {
+               return err
+       }
+       defaultConfig.LogPath = path
+       return nil
+}
+func isValidLogPath(path string) error {

Review Comment:
   The func name not match the return value. If no bool value is returned, you 
are advised not to use "is". It is recommended to use "verifyLogPath" as the 
name.



##########
inlong-tubemq/tubemq-client-twins/tubemq-client-go/config/config.go:
##########
@@ -143,6 +144,10 @@ type Config struct {
                // AfterFail is the heartbeat timeout after a heartbeat failure.
                AfterFail time.Duration
        }
+       Log struct {
+               LogPath  string
+               LogLevel string

Review Comment:
   Suggest adding comments.



##########
inlong-tubemq/tubemq-client-twins/tubemq-client-go/config/config.go:
##########
@@ -620,3 +638,17 @@ func WithConsumePosition(consumePosition int) Option {
                c.Consumer.ConsumePosition = consumePosition
        }
 }
+
+// WithLogLevel set log level
+func WithLogLevel(level string) Option {
+       return func(c *Config) {
+               c.Log.LogLevel = level
+       }
+}
+
+// WithLogPath set log path
+func WithLogPath(path string) Option {
+       return func(c *Config) {
+               c.Log.LogPath = path
+       }
+}

Review Comment:
   Does this configuration take effect?



-- 
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]

Reply via email to