Skip to content

Commit

Permalink
use io/file package to create the parent directories
Browse files Browse the repository at this point in the history
  • Loading branch information
bharath-123 committed Aug 5, 2023
1 parent 110e81c commit 386c186
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion io/logs/logutil.go
Expand Up @@ -3,6 +3,7 @@
package logs

import (
"github.com/prysmaticlabs/prysm/v4/io/file"
"io"
"net/url"
"os"
Expand All @@ -21,7 +22,7 @@ func addLogWriter(w io.Writer) {
// ConfigurePersistentLogging adds a log-to-file writer. File content is identical to stdout.
func ConfigurePersistentLogging(logFileName string) error {
logrus.WithField("logFileName", logFileName).Info("Logs will be made persistent")
if err := os.MkdirAll(filepath.Dir(logFileName), params.BeaconIoConfig().ReadWriteExecutePermissions); err != nil {
if err := file.MkdirAll(filepath.Dir(logFileName)); err != nil {
return err
}
f, err := os.OpenFile(logFileName, os.O_CREATE|os.O_WRONLY|os.O_APPEND, params.BeaconIoConfig().ReadWritePermissions) // #nosec G304
Expand Down

0 comments on commit 386c186

Please sign in to comment.