forked from forgejo/forgejo
Cleanup log messaging
This change corrects a few logging issues: * Standardized formatting errors with '%v'. * Standardized failure warning word usage. * Corrected an instance of using the standard log library when the gitea log library should be used instead.
This commit is contained in:
parent
73d05a51e3
commit
bf6f61cc69
26 changed files with 111 additions and 112 deletions
|
@ -205,7 +205,7 @@ func getEngine() (*xorm.Engine, error) {
|
|||
return nil, errors.New("this binary version does not build support for SQLite3")
|
||||
}
|
||||
if err := os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm); err != nil {
|
||||
return nil, fmt.Errorf("Fail to create directories: %v", err)
|
||||
return nil, fmt.Errorf("Failed to create directories: %v", err)
|
||||
}
|
||||
connStr = "file:" + DbCfg.Path + "?cache=shared&mode=rwc"
|
||||
case "tidb":
|
||||
|
@ -213,7 +213,7 @@ func getEngine() (*xorm.Engine, error) {
|
|||
return nil, errors.New("this binary version does not build support for TiDB")
|
||||
}
|
||||
if err := os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm); err != nil {
|
||||
return nil, fmt.Errorf("Fail to create directories: %v", err)
|
||||
return nil, fmt.Errorf("Failed to create directories: %v", err)
|
||||
}
|
||||
connStr = "goleveldb://" + DbCfg.Path
|
||||
default:
|
||||
|
@ -237,7 +237,7 @@ func NewTestEngine(x *xorm.Engine) (err error) {
|
|||
func SetEngine() (err error) {
|
||||
x, err = getEngine()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Fail to connect to database: %v", err)
|
||||
return fmt.Errorf("Failed to connect to database: %v", err)
|
||||
}
|
||||
|
||||
x.SetMapper(core.GonicMapper{})
|
||||
|
@ -247,12 +247,12 @@ func SetEngine() (err error) {
|
|||
logPath := path.Join(setting.LogRootPath, "xorm.log")
|
||||
|
||||
if err := os.MkdirAll(path.Dir(logPath), os.ModePerm); err != nil {
|
||||
return fmt.Errorf("Fail to create dir %s: %v", logPath, err)
|
||||
return fmt.Errorf("Failed to create dir %s: %v", logPath, err)
|
||||
}
|
||||
|
||||
f, err := os.Create(logPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Fail to create xorm.log: %v", err)
|
||||
return fmt.Errorf("Failed to create xorm.log: %v", err)
|
||||
}
|
||||
x.SetLogger(xorm.NewSimpleLogger(f))
|
||||
x.ShowSQL(true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue