Skip to content
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

Closed
wants to merge 6 commits into from
Closed

Conversation

smarteng
Copy link

Prepare a Pull Request

(Change the title refer to the following example)

cfg := config.New(config.WithConsumerMasters("master"),
config.WithTopics([]{"topic"}),
config.WithGroup("group"),
config.WithLogLevel("info"),
)
c, err := client.NewConsumer(cfg)

  • Title Example: [INLONG-XYZ][Component] Title of the pull request

(The following XYZ should be replaced by the actual GitHub Issue number)

Motivation

Explain here the context, and why you're making that change. What is the problem you're trying to solve?

Modifications

Describe the modifications you've done.

Verifying this change

(Please pick either of the following options)

  • This change is a trivial rework/code cleanup without any test coverage.

  • This change is already covered by existing tests, such as:
    (please describe tests)

  • This change added tests and can be verified as follows:

    (example:)

    • Added integration tests for end-to-end deployment with large payloads (10MB)
    • Extended integration test for recovery after broker failure

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @smarteng, thank you for submitting a PR to InLong 💖 We will respond as soon as possible ⏳
This seems to be your first PR 🌠 Please be sure to follow our Contribution Guidelines.
If you have any questions in the meantime, you can also ask us on the InLong Discussions 🔍

@gosonzhang gosonzhang changed the title up [INLONG-8791][TubeMQ] tubemq-client-go lacks log level configuration API Aug 24, 2023
@dockerzhang dockerzhang changed the title [INLONG-8791][TubeMQ] tubemq-client-go lacks log level configuration API [INLONG-8791][TubeMQ] Tubemq-client-go lacks log level configuration API Aug 24, 2023
@dockerzhang dockerzhang added this to the 1.9.0 milestone Aug 24, 2023
@@ -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)
Copy link
Contributor

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

@@ -39,3 +39,18 @@ var defaultConfig = &OutputConfig{
MaxAge: 3,
Level: "warn",
}

// SetLogLevel set log level
func SetLogLevel(level string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check whether the set value is legal and valid

}

// SetLogPath set log path
func SetLogPath(path string) {
Copy link
Contributor

Choose a reason for hiding this comment

The 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

}

// GetLogConfig get log config
func GetLogConfig() *OutputConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improve][TubeMQ] tubemq-client-go lacks log level configuration API
4 participants