refactor:优化日志打印方式
This commit is contained in:
11
Util/file.go
11
Util/file.go
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user