1
0
Fork 0
forked from forgejo/forgejo

Clean up log messages (#30313)

`log.Xxx("%v")` is not ideal, this PR adds necessary context messages.
Remove some unnecessary logs.

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 83f83019ef3471b847a300f0821499b3896ec987)

Conflicts:
	- modules/util/util.go
          Conflict resolved by picking `util.Iif` from 654cfd1dfbd3f3f1d94addee50b6fe2b018a49c3
(cherry picked from commit 492d116b2a468991f44d6d37ec33f918ccbe4514)

Conflicts:
	modules/util/util.go
	trivial context conflict as the commit is picked from https://codeberg.org/forgejo/forgejo/pulls/3212
This commit is contained in:
wxiaoguang 2024-04-07 19:17:06 +08:00 committed by Earl Warren
parent 78944bb709
commit c5d6cb5b52
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
16 changed files with 38 additions and 44 deletions

View file

@ -212,3 +212,11 @@ func ToFloat64(number any) (float64, error) {
func ToPointer[T any](val T) *T {
return &val
}
// Iif is an "inline-if", it returns "trueVal" if "condition" is true, otherwise "falseVal"
func Iif[T any](condition bool, trueVal, falseVal T) T {
if condition {
return trueVal
}
return falseVal
}