aboutsummaryrefslogtreecommitdiffstats
path: root/modules/log/file.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-03-01 21:08:10 +0000
committerGitHub <noreply@github.com>2021-03-01 22:08:10 +0100
commitf0e15250b9e322cc7731ba026d12387c2b549a42 (patch)
treef13d46119077ba924d620ef172b91daa315bda0a /modules/log/file.go
parent59fd641d1fb021e35aea7f9f4a1916cc11ef5c51 (diff)
downloadgitea-f0e15250b9e322cc7731ba026d12387c2b549a42.tar.gz
gitea-f0e15250b9e322cc7731ba026d12387c2b549a42.zip
Migrate to use jsoniter instead of encoding/json (#14841)
* Migrate to use jsoniter * fix tests * update gitea.com/go-chi/binding Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'modules/log/file.go')
-rw-r--r--modules/log/file.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/log/file.go b/modules/log/file.go
index c9b5d47c0b..d5b38d4e01 100644
--- a/modules/log/file.go
+++ b/modules/log/file.go
@@ -7,7 +7,6 @@ package log
import (
"bufio"
"compress/gzip"
- "encoding/json"
"errors"
"fmt"
"os"
@@ -17,6 +16,7 @@ import (
"time"
"code.gitea.io/gitea/modules/util"
+ jsoniter "github.com/json-iterator/go"
)
// FileLogger implements LoggerProvider.
@@ -101,8 +101,9 @@ func NewFileLogger() LoggerProvider {
// "rotate":true
// }
func (log *FileLogger) Init(config string) error {
+ json := jsoniter.ConfigCompatibleWithStandardLibrary
if err := json.Unmarshal([]byte(config), log); err != nil {
- return err
+ return fmt.Errorf("Unable to parse JSON: %v", err)
}
if len(log.Filename) == 0 {
return errors.New("config must have filename")