mirror of https://bitbucket.org/ausocean/av.git
ensure only one logger is ever created
This commit is contained in:
parent
90288f546a
commit
369beab55c
12
RevidCLI.go
12
RevidCLI.go
|
@ -241,12 +241,12 @@ func main() {
|
|||
config.Timeout = *configFlags[timeoutPtr]
|
||||
config.IntraRefreshPeriod = *configFlags[intraRefreshPeriodPtr]
|
||||
|
||||
// Also give the config a logger object
|
||||
config.Logger = smartlogger.New(loggerVerbosity, smartlogger.File, "/var/log/netsender/")
|
||||
|
||||
//init netsender
|
||||
if *netSenderFlagPtr {
|
||||
netsenderInit()
|
||||
} else {
|
||||
// Also give the config a logger object
|
||||
config.Logger = smartlogger.New(loggerVerbosity, smartlogger.File, "/var/log/netsender/")
|
||||
}
|
||||
|
||||
time.Sleep(time.Duration(prepTime) * time.Second)
|
||||
|
@ -257,14 +257,14 @@ func main() {
|
|||
for *netSenderFlagPtr {
|
||||
varsChanged, err := netSend()
|
||||
if err != nil {
|
||||
config.Logger.Log("revidCLI","Error", err.Error())
|
||||
config.Logger.Log("revidCLI", "Error", err.Error())
|
||||
time.Sleep(time.Duration(netSendRetryTime) * time.Second)
|
||||
continue
|
||||
}
|
||||
if varsChanged {
|
||||
if vars["mode"] == "Paused" {
|
||||
if !paused {
|
||||
config.Logger.Log("revidCLI","Info", "Pausing revid")
|
||||
config.Logger.Log("revidCLI", "Info", "Pausing revid")
|
||||
stopRevid()
|
||||
paused = true
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ func createRevidInstance() {
|
|||
// If the config does have a logger, use it to output error, otherwise
|
||||
// just output to std output
|
||||
if config.Logger != nil {
|
||||
config.Logger.Log("revidCLI","FATAL ERROR", err.Error())
|
||||
config.Logger.Log("revidCLI", "FATAL ERROR", err.Error())
|
||||
} else {
|
||||
fmt.Printf("FATAL ERROR: %v", err.Error())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue