Fix logger refactoring regression: manager logging add (#24847)

The `rotate` option is optional.

Test result:

![image](https://github.com/go-gitea/gitea/assets/2114189/7cff8207-dcf3-4988-adef-247f1c9316e7)
This commit is contained in:
wxiaoguang 2023-05-24 08:09:33 +08:00 committed by GitHub
parent 21add7ea88
commit 979f08053f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -155,7 +155,7 @@ func AddLogger(ctx *context.PrivateContext) {
writerOption := log.WriterFileOption{}
fileName, _ := opts.Config["filename"].(string)
writerOption.FileName = setting.LogPrepareFilenameForWriter(fileName, opts.Writer+".log")
writerOption.LogRotate = opts.Config["rotate"].(bool)
writerOption.LogRotate, _ = opts.Config["rotate"].(bool)
maxSizeShift, _ := opts.Config["maxsize"].(int)
if maxSizeShift == 0 {
maxSizeShift = 28