Skip to content
This repository has been archived by the owner on May 9, 2021. It is now read-only.

Commit

Permalink
🎨 修复初始化配置目录问题
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Feb 16, 2020
1 parent a82c9e8 commit 24dfad9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 1 addition & 6 deletions kernel/conf.go
Expand Up @@ -47,12 +47,7 @@ func Close() {

func InitConf() {
Conf = &AppConf{LogLevel: "debug", Theme: "white", Lang: "zh_CN"}
if !gulu.File.IsExist(ConfPath) {
if err := os.Mkdir(LianDiDir, 0755); nil != err && !os.IsExist(err) {
Logger.Fatalf("创建配置目录 [%s] 失败:%s", LianDiDir, err)
}
Logger.Infof("初始化配置文件 [%s] 完毕", ConfPath)
} else {
if gulu.File.IsExist(ConfPath) {
data, err := ioutil.ReadFile(ConfPath)
if nil != err {
Logger.Fatalf("加载配置文件 [%s] 失败:%s", ConfPath, err)
Expand Down
6 changes: 6 additions & 0 deletions kernel/log.go
Expand Up @@ -28,6 +28,12 @@ var (
)

func InitLog() {
if !gulu.File.IsExist(LianDiDir) {
if err := os.Mkdir(LianDiDir, 0755); nil != err && !os.IsExist(err) {
Logger.Fatalf("创建配置目录 [%s] 失败:%s", LianDiDir, err)
}
}

if size := gulu.File.GetFileSize(LogPath); 1024*1024*8 <= size {
// 日志文件大于 8M 的话删了重建
if err := os.Remove(LogPath); nil != err {
Expand Down

0 comments on commit 24dfad9

Please sign in to comment.