Skip to content

feat: logger module refactorization #2838

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

Merged
merged 9 commits into from
May 19, 2025

Conversation

Flying-Tom
Copy link
Contributor

#2526 add SetLoggerLevel for logger module, logger options can be modified by this function as follow.

package main

import (
	"context"
	"time"

	"dubbo.apache.org/dubbo-go/v3"
	"dubbo.apache.org/dubbo-go/v3/protocol"

	_ "dubbo.apache.org/dubbo-go/v3/imports"
	"github.com/dubbogo/gost/log/logger"

	log "dubbo.apache.org/dubbo-go/v3/logger"
)

func main() {
	ins, err := dubbo.NewInstance(
		dubbo.WithProtocol(
			protocol.WithTriple(),
			protocol.WithPort(20000),
		),
		dubbo.WithLogger(
			log.WithLevel("warn"),
			log.WithZap(),
		),
	)
	logger.SetLoggerLevel("debug")
	if err != nil {
		panic(err)
	}
	server, err := ins.NewServer()
	if err != nil {
		panic(err)
	}
	go server.Serve()
	ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
	defer cancel()
	for {
		select {
		case <-ctx.Done():
			return
		default:
			logger.Info("hello dubbogo this is info log")
			logger.Debug("hello dubbogo this is debug log")
			logger.Warn("hello dubbogo this is warn log")
			time.Sleep(time.Second * 1)
		}
	}
}

@Flying-Tom Flying-Tom force-pushed the logger-refactor branch 3 times, most recently from c211dba to ffdd040 Compare April 16, 2025 06:52
@FoghostCn FoghostCn requested a review from Copilot April 17, 2025 07:20
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • go.mod: Language not supported

@AlexStocks
Copy link
Contributor

Please check the ci failure.

@Flying-Tom
Copy link
Contributor Author

Flying-Tom commented Apr 17, 2025

Please check the ci failure.

caused by gost, pr need to be merged.

pr dubbogo/gost#122 need to be merged

@marsevilspirit
Copy link
Member

Please check the ci failure.

caused by gost, pr need to be merged.

CI must pass, we need to ensure the quality of the code.

Copy link
Member

@No-SilverBullet No-SilverBullet left a comment

Choose a reason for hiding this comment

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

LGTM

Flying-Tom and others added 4 commits May 18, 2025 21:58
…che#2850) (apache#2878)

* update golangci-lint to v2 and fix the issues detected by it

* change .github\workflows\golangci-lint.yml

* change .github\workflows\golangci-lint.yml

* change .github\workflows\golangci-lint.yml

* fix issues detected by golangci-lint
Copy link

@AlexStocks
Copy link
Contributor

请把 gost 版本升级到最新版 https://github.com/dubbogo/gost/releases/tag/v1.14.1

@Flying-Tom
Copy link
Contributor Author

请把 gost 版本升级到最新版 https://github.com/dubbogo/gost/releases/tag/v1.14.1

done

Copy link
Member

@marsevilspirit marsevilspirit left a comment

Choose a reason for hiding this comment

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

LGTM!

@AlexStocks AlexStocks merged commit 3dc377f into apache:develop May 19, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants