Skip to content

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 6e90057 commit 4710507
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions p2p/transport/quic/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 4710507

Please sign in to comment.