diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-06-28 14:02:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 08:02:06 +0200 |
commit | 65d3e1161b0544f50d94dbbecb6bcf135535e112 (patch) | |
tree | 2f1a9a0630e37c9db17b842122b425b46b501867 /cmd/web.go | |
parent | b943318617633e7dc43f3ac1c146be1e37563093 (diff) | |
download | gitea-65d3e1161b0544f50d94dbbecb6bcf135535e112.tar.gz gitea-65d3e1161b0544f50d94dbbecb6bcf135535e112.zip |
Fix sub-command log level (#25537)
More fix for #24981
* #24981
Close #22361
* #22361
There were many patches for Gitea's sub-commands to satisfy the facts:
* Some sub-commands shouldn't output any log, otherwise the git protocol
would be broken
* Sometimes the users want to see "verbose" or "quiet" outputs
That's a longstanding problem, and very fragile. This PR is only a quick
patch for the problem.
In the future, the sub-command system should be refactored to a clear
solution.
----
Other changes:
* Use `ReplaceAllWriters` to replace
`RemoveAllWriters().AddWriters(writer)`, then it's an atomic operation.
* Remove unnecessary `syncLevelInternal` calls, because
`AddWriters/addWritersInternal` already calls it.
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'cmd/web.go')
-rw-r--r-- | cmd/web.go | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/cmd/web.go b/cmd/web.go index 7a257a62a2..05f3b2ddb2 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -35,6 +35,7 @@ var CmdWeb = cli.Command{ Usage: "Start Gitea web server", Description: `Gitea web server is the only thing you need to run, and it takes care of all the other things for you`, + Before: PrepareConsoleLoggerLevel(log.INFO), Action: runWeb, Flags: []cli.Flag{ cli.StringFlag{ @@ -206,11 +207,6 @@ func servePprof() { } func runWeb(ctx *cli.Context) error { - if ctx.Bool("verbose") { - setupConsoleLogger(log.TRACE, log.CanColorStdout, os.Stdout) - } else if ctx.Bool("quiet") { - setupConsoleLogger(log.FATAL, log.CanColorStdout, os.Stdout) - } defer func() { if panicked := recover(); panicked != nil { log.Fatal("PANIC: %v\n%s", panicked, log.Stack(2)) |