Ensure log path is created on startup

This commit is contained in:
James Mills 2022-04-03 20:49:54 +10:00
rodič b4e7582a6d
revize 9cc910631d
V databázi nebyl nalezen žádný známý klíč pro tento podpis
ID GPG klíče: AC4C014F1440EBD6

Zobrazit soubor

@ -1,6 +1,11 @@
package msgbus
import "github.com/tidwall/wal"
import (
"fmt"
"os"
"github.com/tidwall/wal"
)
const (
// DefaultBind is the default bind address
@ -55,6 +60,9 @@ type Option func(opts *Options) error
func WithLogPath(logPath string) Option {
return func(opts *Options) error {
if err := os.MkdirAll(logPath, 0755); err != nil {
return fmt.Errorf("error creating log path %s: %w", logPath, err)
}
opts.LogPath = logPath
return nil
}