feat: 加入对直接访问https api的支持

This commit is contained in:
Mmx233
2022-03-01 23:24:57 +08:00
parent 7867a99f3b
commit d0f9ea488c
9 changed files with 43 additions and 17 deletions

View File

@@ -2,7 +2,6 @@ package util
import (
"fmt"
"github.com/Mmx233/BitSrunLoginGo/global"
"github.com/Mmx233/tool"
"log"
"os"
@@ -13,12 +12,24 @@ import (
type loG struct {
timeStamp string
WriteFile bool
Path string
Debug bool
OutPut bool
}
var Log loG
func (c *loG) Init(debug, logFile, outPut bool, path string) {
c.Debug = debug
c.WriteFile = logFile
c.OutPut = outPut
c.Path = path
}
func (c *loG) time() string {
return time.Now().Format("2006/01/02 15:04:05")
}
func (c *loG) WriteLog(name string, a ...interface{}) {
if !(c.Debug && c.WriteFile) {
return
@@ -30,7 +41,7 @@ func (c *loG) WriteLog(name string, a ...interface{}) {
t += " "
}
}
err := tool.File.Add(global.Config.Settings.Debug.Path+name, fmt.Sprintf(time.Now().Format("2006/01/02 15:04:05 "))+t, 700)
err := tool.File.Add(c.Path+name, c.time()+" "+t, 700)
if err != nil {
log.Println("Write log error: ", err)
}
@@ -38,7 +49,7 @@ func (c *loG) WriteLog(name string, a ...interface{}) {
func (c *loG) genTimeStamp() {
if c.timeStamp == "" {
c.timeStamp = time.Now().Format("2006.01.02-15.04.05")
c.timeStamp = c.time()
}
}