优化数据与日志模块

This commit is contained in:
boyce
2019-02-13 16:17:06 +08:00
parent e484d0a18b
commit 1ef059e236
2 changed files with 9 additions and 1 deletions

View File

@@ -9,10 +9,13 @@ import (
"strconv" "strconv"
"strings" "strings"
"time" "time"
"github.com/duanhf2012/origin/service"
) )
// DBModule ... // DBModule ...
type DBModule struct { type DBModule struct {
service.BaseModule
db *sql.DB db *sql.DB
URL string URL string
UserName string UserName string
@@ -31,6 +34,11 @@ type DBResult struct {
blur bool blur bool
} }
//OnInit ...
func (slf *DBModule) Init() {
slf.Connect(100)
}
// Next ... // Next ...
func (slf *DBResult) Next() bool { func (slf *DBResult) Next() bool {
if slf.Err != nil { if slf.Err != nil {

View File

@@ -50,7 +50,7 @@ func (slf *LogModule) CheckAndGenFile() {
var err error var err error
slf.logFile, err = os.Create(slf.GetCurrentFileName()) slf.logFile, err = os.Create(slf.GetCurrentFileName())
if err != nil { if err != nil {
fmt.Print("create log file %s error!", slf.GetCurrentFileName()) fmt.Printf("create log file %+v error!", slf.GetCurrentFileName())
return return
} }