Minor changes
This commit is contained in:
parent
a6c0ebddf4
commit
e0f73db7e4
14
logger.go
14
logger.go
@ -71,34 +71,34 @@ var (
|
||||
)
|
||||
|
||||
func SetLogger(env LogEnvironment) {
|
||||
var logdir = "./logs"
|
||||
var logDir = "./logs"
|
||||
|
||||
switch env {
|
||||
case Development:
|
||||
// file system not used
|
||||
case Debug:
|
||||
if _, err := os.Stat(logdir); os.IsNotExist(err) {
|
||||
if err = os.Mkdir(logdir, os.ModePerm); err != nil {
|
||||
if _, err := os.Stat(logDir); os.IsNotExist(err) {
|
||||
if err = os.Mkdir(logDir, os.ModePerm); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := os.Stat("./logs/debug"); os.IsNotExist(err) {
|
||||
file, err := os.Create(filepath.Join(logdir, "debug"))
|
||||
file, err := os.Create(filepath.Join(logDir, "debug"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
_ = file.Close()
|
||||
}
|
||||
case Testing:
|
||||
if _, err := os.Stat(logdir); os.IsNotExist(err) {
|
||||
if err = os.Mkdir(logdir, os.ModePerm); err != nil {
|
||||
if _, err := os.Stat(logDir); os.IsNotExist(err) {
|
||||
if err = os.Mkdir(logDir, os.ModePerm); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := os.Stat("./logs/debug_test"); os.IsNotExist(err) {
|
||||
file, err := os.Create(filepath.Join(logdir, "debug_test"))
|
||||
file, err := os.Create(filepath.Join(logDir, "debug_test"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user