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

Move xorm logger bridge from log to models so that log module could be a standalone package #6944

Merged
merged 3 commits into from May 14, 2019

Conversation

lunny
Copy link
Member

@lunny lunny commented May 14, 2019

As title.

@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label May 14, 2019
@lunny lunny added this to the 1.9.0 milestone May 14, 2019
models/log.go Outdated
func InitXORMLogger(showSQL bool) {
XORMLogger = &XORMLogBridge{
// NeXORMLogger inits a log bridge for xorm
func NeXORMLogger(showSQL bool) core.ILogger {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func NeXORMLogger(showSQL bool) core.ILogger {
func NewXORMLogger(showSQL bool) core.ILogger {

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 14, 2019
models/models.go Outdated
@@ -261,7 +260,7 @@ func NewTestEngine(x *xorm.Engine) (err error) {
}

x.SetMapper(core.GonicMapper{})
x.SetLogger(log.XORMLogger)
x.SetLogger(NeXORMLogger(!setting.ProdMode))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
x.SetLogger(NeXORMLogger(!setting.ProdMode))
x.SetLogger(NewXORMLogger(!setting.ProdMode))

models/models.go Outdated
@@ -276,7 +275,7 @@ func SetEngine() (err error) {
x.SetMapper(core.GonicMapper{})
// WARNING: for serv command, MUST remove the output to os.stdout,
// so use log file to instead print to stdout.
x.SetLogger(log.XORMLogger)
x.SetLogger(NeXORMLogger(setting.LogSQL))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
x.SetLogger(NeXORMLogger(setting.LogSQL))
x.SetLogger(NewXORMLogger(setting.LogSQL))

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 14, 2019
@codecov-io
Copy link

Codecov Report

Merging #6944 into master will increase coverage by 0.01%.
The diff coverage is 45%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #6944      +/-   ##
=========================================
+ Coverage   41.39%   41.4%   +0.01%     
=========================================
  Files         441     441              
  Lines       59733   59729       -4     
=========================================
+ Hits        24727   24732       +5     
+ Misses      31767   31758       -9     
  Partials     3239    3239
Impacted Files Coverage Δ
modules/setting/log.go 74.76% <ø> (+1.03%) ⬆️
models/log.go 41.86% <44.44%> (ø)
models/models.go 56.59% <50%> (ø) ⬆️
models/repo_list.go 66.84% <0%> (-1.06%) ⬇️
routers/repo/view.go 43.03% <0%> (+1.01%) ⬆️
models/unit.go 67.56% <0%> (+5.4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e057eb...4b1191b. Read the comment docs.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 14, 2019
@lafriks lafriks merged commit 8b36f01 into go-gitea:master May 14, 2019
@lunny lunny deleted the lunny/log_as_standalone branch May 14, 2019 07:10
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants