2
0

add code for always opening new with default dir and name. with test.

This commit is contained in:
Nate Finch
2014-06-15 08:53:04 -04:00
parent 29a1a3fa69
commit 245c33893c
2 changed files with 38 additions and 1 deletions
+3
View File
@@ -184,6 +184,9 @@ func (l *Logger) openNew() (*os.File, error) {
// no such file or the write would put it over the MaxSize, a new file is
// created.
func (l *Logger) openExistingOrNew(writeLen int) (*os.File, error) {
if l.Dir == "" && l.NameFormat == "" {
return l.openNew()
}
files, err := ioutil.ReadDir(l.dir())
if os.IsNotExist(err) {
return l.openNew()