Remove most global variables from main.go
This takes advantage of the newly created parseCommandLineOptions() function and makes it work so that it now returns a nice struct of options rather than relying on global variables. There are a few global variables left, but they will take a bit more refactoring in order to be removed, so it'll happen in later commits.
This commit is contained in:
@@ -34,13 +34,14 @@ const (
|
||||
logFileMaxOpenTime = time.Minute
|
||||
)
|
||||
|
||||
func monitorMain() {
|
||||
func monitorMain(runtimeOptions RuntimeOptions) {
|
||||
os.Setenv("STNORESTART", "yes")
|
||||
os.Setenv("STMONITORED", "yes")
|
||||
l.SetPrefix("[monitor] ")
|
||||
|
||||
var dst io.Writer = os.Stdout
|
||||
|
||||
logFile := runtimeOptions.logFile
|
||||
if logFile != "-" {
|
||||
var fileDst io.Writer = newAutoclosedFile(logFile, logFileAutoCloseDelay, logFileMaxOpenTime)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user