@@ -284,8 +284,6 @@ func newRouterLogService() {
284
284
}
285
285
286
286
func newLogService () {
287
- log .Info ("Gitea v%s%s" , AppVer , AppBuiltWith )
288
-
289
287
options := newDefaultLogOptions ()
290
288
options .bufferLength = Cfg .Section ("log" ).Key ("BUFFER_LEN" ).MustInt64 (10000 )
291
289
EnableSSHLog = Cfg .Section ("log" ).Key ("ENABLE_SSH_LOG" ).MustBool (false )
@@ -297,24 +295,14 @@ func newLogService() {
297
295
sections := strings .Split (Cfg .Section ("log" ).Key ("MODE" ).MustString ("console" ), "," )
298
296
299
297
useConsole := false
300
- for i := 0 ; i < len (sections ); i ++ {
301
- sections [i ] = strings .TrimSpace (sections [i ])
302
- if sections [i ] == "console" {
303
- useConsole = true
304
- }
305
- }
306
-
307
- if ! useConsole {
308
- err := log .DelLogger ("console" )
309
- if err != nil {
310
- log .Fatal ("DelLogger: %v" , err )
311
- }
312
- }
313
-
314
298
for _ , name := range sections {
315
- if len (name ) == 0 {
299
+ name = strings .TrimSpace (name )
300
+ if name == "" {
316
301
continue
317
302
}
303
+ if name == "console" {
304
+ useConsole = true
305
+ }
318
306
319
307
sec , err := Cfg .GetSection ("log." + name + ".default" )
320
308
if err != nil {
@@ -336,6 +324,13 @@ func newLogService() {
336
324
337
325
AddLogDescription (log .DEFAULT , & description )
338
326
327
+ if ! useConsole {
328
+ log .Info ("According to the configuration, subsequent logs will not be printed to the console" )
329
+ if err := log .DelLogger ("console" ); err != nil {
330
+ log .Fatal ("Cannot delete console logger: %v" , err )
331
+ }
332
+ }
333
+
339
334
// Finally redirect the default golog to here
340
335
golog .SetFlags (0 )
341
336
golog .SetPrefix ("" )
0 commit comments