From 7ab7fd01b54e02f79432ac0ff089d65f95221ca5 Mon Sep 17 00:00:00 2001 From: q191201771 <191201771@qq.com> Date: Mon, 30 Sep 2019 12:06:05 +0800 Subject: [PATCH] package nazalog: mkdir 777 --- pkg/nazalog/log.go | 2 +- pkg/nazalog/log_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/nazalog/log.go b/pkg/nazalog/log.go index 9c706a3..f9f35ea 100644 --- a/pkg/nazalog/log.go +++ b/pkg/nazalog/log.go @@ -96,7 +96,7 @@ func New(modOptions ...ModOption) (Logger, error) { } if l.option.Filename != "" { l.dir = filepath.Dir(l.option.Filename) - if err = os.MkdirAll(l.dir, 0666); err != nil { + if err = os.MkdirAll(l.dir, 0777); err != nil { return nil, err } if l.fp, err = os.OpenFile(l.option.Filename, os.O_CREATE | os.O_WRONLY | os.O_APPEND, 0666); err != nil { diff --git a/pkg/nazalog/log_test.go b/pkg/nazalog/log_test.go index 306fa5a..3aa3e90 100644 --- a/pkg/nazalog/log_test.go +++ b/pkg/nazalog/log_test.go @@ -13,7 +13,7 @@ import ( func TestLogger(t *testing.T) { l, err := New(func(option *Option) { option.Level = LevelInfo - option.Filename = "/tmp/lallogtest/aaa.log" + option.Filename = "/tmp/nazalogtest/aaa.log" option.IsToStdout = true option.IsRotateDaily = true }) @@ -47,7 +47,7 @@ func TestGlobal(t *testing.T) { err := Init(func(option *Option) { option.Level = LevelInfo - option.Filename = "/tmp/lallogtest/bbb.log" + option.Filename = "/tmp/nazalogtest/bbb.log" option.IsToStdout = true }) @@ -92,7 +92,7 @@ func TestNew(t *testing.T) { func TestRotate(t *testing.T) { err := Init(func(option *Option) { option.Level = LevelInfo - option.Filename = "/tmp/lallogtest/ccc.log" + option.Filename = "/tmp/nazalogtest/ccc.log" option.IsToStdout = false option.IsRotateDaily = true