|
@@ -22,8 +22,11 @@ import (
|
|
"github.com/gogf/gf/v2/os/gctx"
|
|
"github.com/gogf/gf/v2/os/gctx"
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
|
|
+ "gopkg.in/natefinch/lumberjack.v2"
|
|
|
|
+ "io"
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
"log"
|
|
"log"
|
|
|
|
+ "os"
|
|
"regexp"
|
|
"regexp"
|
|
"strings"
|
|
"strings"
|
|
"time"
|
|
"time"
|
|
@@ -86,6 +89,14 @@ func init() {
|
|
}
|
|
}
|
|
|
|
|
|
func main() {
|
|
func main() {
|
|
|
|
+ logger := &lumberjack.Logger{
|
|
|
|
+ Filename: "./logs/openPower.log",
|
|
|
|
+ MaxSize: 1024,
|
|
|
|
+ MaxBackups: 300,
|
|
|
|
+ MaxAge: 300,
|
|
|
|
+ Compress: true,
|
|
|
|
+ }
|
|
|
|
+ log.SetOutput(io.MultiWriter(logger, os.Stdout))
|
|
MysqlMain = &ml.Mysql{
|
|
MysqlMain = &ml.Mysql{
|
|
Address: c.Mysql.Main.Address,
|
|
Address: c.Mysql.Main.Address,
|
|
UserName: c.Mysql.Main.UserName,
|
|
UserName: c.Mysql.Main.UserName,
|