Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
simplify the mkdir for the QLOGDIR
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Apr 6, 2020
1 parent 67f3ae7 commit 7c0a17b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,9 @@ func (t *transport) GetLogWriterFor(role string) func([]byte) io.WriteCloser {
}
return func(connID []byte) io.WriteCloser {
// create the QLOGDIR, if it doesn't exist
if _, err := os.Stat(qlogDir); os.IsNotExist(err) {
if err := os.MkdirAll(qlogDir, 0777); err != nil {
log.Errorf("creating the QLOGDIR failed: %s", err)
return nil
}
if err := os.MkdirAll(qlogDir, 0777); err != nil {
log.Errorf("creating the QLOGDIR failed: %s", err)
return nil
}
t := time.Now().Format(time.RFC3339Nano)
filename := fmt.Sprintf("%s/log_%s_%s_%x.qlog.gz", qlogDir, t, role, connID)
Expand Down

0 comments on commit 7c0a17b

Please sign in to comment.