Skip to content

Commit

Permalink
Rearrange the loader logging statements.
Browse files Browse the repository at this point in the history
I want the pid included - it makes debugging easier. So I need to wait
until the process starts.
  • Loading branch information
gcla committed Nov 25, 2019
1 parent 0d64c6a commit b80def4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions pcap/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -1207,15 +1207,15 @@ func (c *Loader) loadPcapAsync(row int, cb interface{}) {
return
}

log.Infof("Starting PDML command: %v", c.PdmlCmd)

err = c.PdmlCmd.Start()
if err != nil {
err = fmt.Errorf("Error starting PDML process %v: %v", c.PdmlCmd, err)
HandleError(err, cb)
return
}

log.Infof("Started PDML command %v with pid %d", c.PdmlCmd, c.PdmlCmd.Pid())

defer func() {
c.PdmlCmd.Wait()
}()
Expand Down Expand Up @@ -1327,8 +1327,6 @@ func (c *Loader) loadPcapAsync(row int, cb interface{}) {
return
}

log.Infof("Starting pcap command: %v", c.PcapCmd)

err = c.PcapCmd.Start()
if err != nil {
// e.g. on the pi
Expand All @@ -1337,6 +1335,8 @@ func (c *Loader) loadPcapAsync(row int, cb interface{}) {
return
}

log.Infof("Started pcap command %v with pid %d", c.PcapCmd, c.PcapCmd.Pid())

defer func() {
c.PcapCmd.Wait()
}()
Expand Down Expand Up @@ -1681,8 +1681,6 @@ func (c *Loader) loadPsmlAsync(cb interface{}) {
return
}

log.Infof("Starting PSML command: %v", c.PsmlCmd)

err = c.PsmlCmd.Start()
if err != nil {
err = fmt.Errorf("Error starting PSML command %v: %v", c.PsmlCmd, err)
Expand All @@ -1691,6 +1689,8 @@ func (c *Loader) loadPsmlAsync(cb interface{}) {
return
}

log.Infof("Started PSML command %v with pid %d", c.PsmlCmd, c.PsmlCmd.Pid())

defer func() {
// These need to close so the tailreader Read() terminates so that the
// PsmlCmd.Wait() below completes.
Expand Down
8 changes: 4 additions & 4 deletions streams/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ func (c *Loader) loadStreamReassemblyAsync(pcapf string, proto string, idx int,

c.streamCmd = c.cmds.Stream(pcapf, proto, idx)

log.Infof("Starting stream reassembly command: %v", c.streamCmd)

streamOut, err := c.streamCmd.StdoutReader()
if err != nil {
pcap.HandleError(err, cb)
Expand All @@ -140,6 +138,8 @@ func (c *Loader) loadStreamReassemblyAsync(pcapf string, proto string, idx int,
return
}

log.Infof("Started stream reassembly command %v with pid %d", c.streamCmd, c.streamCmd.Pid())

defer func() {
err = c.streamCmd.Wait() // it definitely started, so we must wait
if !c.SuppressErrors && err != nil {
Expand Down Expand Up @@ -188,8 +188,6 @@ func (c *Loader) startStreamIndexerAsync(pcapf string, proto string, idx int, ap

c.indexerCmd = c.cmds.Indexer(pcapf, proto, idx)

log.Infof("Starting stream indexer command: %v", c.indexerCmd)

streamOut, err := c.indexerCmd.StdoutReader()
if err != nil {
pcap.HandleError(err, cb)
Expand All @@ -209,6 +207,8 @@ func (c *Loader) startStreamIndexerAsync(pcapf string, proto string, idx int, ap
return
}

log.Infof("Started stream indexer command %v with pid %d", c.indexerCmd, c.indexerCmd.Pid())

defer func() {
err = c.indexerCmd.Wait() // it definitely started, so we must wait
if !c.SuppressErrors && err != nil {
Expand Down

0 comments on commit b80def4

Please sign in to comment.