Add unit test for log.go

This commit is contained in:
hantmac
2019-08-31 11:30:41 +08:00
parent f4a5dfa503
commit 39a2a3d635

View File

@@ -0,0 +1,22 @@
package services
import (
"crawlab/config"
"github.com/apex/log"
. "github.com/smartystreets/goconvey/convey"
"github.com/spf13/viper"
"testing"
)
func TestDeleteLogPeriodically(t *testing.T) {
Convey("Test DeleteLogPeriodically", t, func() {
if err := config.InitConfig("../conf/config.yml"); err != nil {
log.Error("init config error:" + err.Error())
panic(err)
}
log.Info("初始化配置成功")
logDir := viper.GetString("log.path")
log.Info(logDir)
DeleteLogPeriodically()
})
}