refactor:优化日志打印方式

This commit is contained in:
Mmx
2021-05-03 14:30:15 +08:00
parent fb562f92c9
commit 7ceb7169e5
6 changed files with 36 additions and 32 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
)
type file struct {
@@ -35,5 +36,13 @@ func (*file) Write(path string, receiver interface{}) error {
if err != nil {
return err
}
return ioutil.WriteFile(path, data, 777)
return ioutil.WriteFile(path, data, 700)
}
func (*file) GetRootPath() string {
t, err := os.Executable()
if err != nil {
ErrHandler(err)
}
return filepath.Dir(t)
}