MCPcopy Create free account
hub / github.com/gogs/gogs / newLogWriter

Function newLogWriter

internal/database/database.go:19–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17)
18
19func newLogWriter() (logger.Writer, error) {
20 sec := conf.File.Section("log.gorm")
21 w, err := log.NewFileWriter(
22 filepath.Join(conf.Log.RootPath, "gorm.log"),
23 log.FileRotationConfig{
24 Rotate: sec.Key("ROTATE").MustBool(true),
25 Daily: sec.Key("ROTATE_DAILY").MustBool(true),
26 MaxSize: sec.Key("MAX_SIZE").MustInt64(100) * 1024 * 1024,
27 MaxDays: sec.Key("MAX_DAYS").MustInt64(3),
28 },
29 )
30 if err != nil {
31 return nil, errors.Wrap(err, `create "gorm.log"`)
32 }
33 return &dbutil.Logger{Writer: w}, nil
34}
35
36// Tables is the list of struct-to-table mappings.
37//

Callers 1

SetEngineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected