Skip to content

Commit

Permalink
Refactor log paths to be OS agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
Djadih committed May 22, 2023
1 parent c4399f7 commit 8d3b1f3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package log
import (
"fmt"
"path"
"path/filepath"
"runtime"
"strings"

Expand Down Expand Up @@ -33,16 +34,16 @@ func ConfigureLogger(ctx *cli.Context) {
Log.SetReportCaller(true)
}

log_filename := "nodelogs/"
log_filename := "nodelogs"
regionNum := ctx.GlobalString("region")

if ctx.GlobalIsSet("zone") {
zoneNum := ctx.GlobalString("zone")
log_filename += "zone-" + regionNum + "-" + zoneNum
log_filename = filepath.Join(log_filename, "zone-" + regionNum + "-" + zoneNum)
} else if ctx.GlobalIsSet("region") {
log_filename += "region-" + regionNum
log_filename = filepath.Join(log_filename, "region-" + regionNum)
} else {
log_filename += "prime"
log_filename = filepath.Join(log_filename, "prime")
}
log_filename += ".log"

Expand Down

0 comments on commit 8d3b1f3

Please sign in to comment.