add file rotation feature for package glog; improve gpool/gfpool; fix issue in gfile.MTimeMillisecond

This commit is contained in:
John
2020-03-15 19:32:26 +08:00
parent e9fba5a166
commit 74be9fac18
17 changed files with 593 additions and 196 deletions

View File

@ -721,7 +721,7 @@ func (c *Core) MarshalJSON() ([]byte, error) {
// writeSqlToLogger outputs the sql object to logger.
// It is enabled when configuration "debug" is true.
func (c *Core) writeSqlToLogger(v *Sql) {
s := fmt.Sprintf("[%d ms] %s", v.End-v.Start, v.Format)
s := fmt.Sprintf("[%3d ms] %s", v.End-v.Start, v.Format)
if v.Error != nil {
s += "\nError: " + v.Error.Error()
c.logger.StackWithFilter(gPATH_FILTER_KEY).Error(s)

View File

@ -62,6 +62,7 @@ func init() {
} else {
db = r
}
db.SetDebug(true)
schemaTemplate := "CREATE DATABASE IF NOT EXISTS `%s` CHARACTER SET UTF8"
if _, err := db.Exec(fmt.Sprintf(schemaTemplate, SCHEMA1)); err != nil {
gtest.Error(err)