mirror of
https://github.com/kemko/xc.git
synced 2026-01-01 15:55:43 +03:00
more debug logging
This commit is contained in:
@@ -189,6 +189,9 @@ func RunCollapse(hosts []string, cmd string) *ExecResult {
|
||||
case d := <-pool.Data:
|
||||
switch d.Type {
|
||||
case MTData:
|
||||
if currentDebug {
|
||||
log.Debugf("DATASTREAM @ %s:\n%v\n[%v]\n", d.Hostname, d.Data, string(d.Data))
|
||||
}
|
||||
outputs[d.Hostname] += string(d.Data)
|
||||
logData := make([]byte, len(d.Data))
|
||||
copy(logData, d.Data)
|
||||
@@ -198,7 +201,7 @@ func RunCollapse(hosts []string, cmd string) *ExecResult {
|
||||
writeHostOutput(d.Hostname, logData)
|
||||
case MTDebug:
|
||||
if currentDebug {
|
||||
log.Debugf("DATASTREAM @ %s\n%v\n[%v]", d.Hostname, d.Data, string(d.Data))
|
||||
log.Debugf("DEBUGSTREAM @ %s:\n%v\n[%v]\n", d.Hostname, d.Data, string(d.Data))
|
||||
}
|
||||
case MTCopyFinished:
|
||||
if d.StatusCode == 0 {
|
||||
@@ -226,12 +229,15 @@ func RunCollapse(hosts []string, cmd string) *ExecResult {
|
||||
bar.Finish()
|
||||
}
|
||||
|
||||
for k, v := range outputs {
|
||||
_, found := r.Outputs[v]
|
||||
for host, hostOutput := range outputs {
|
||||
_, found := r.Outputs[hostOutput]
|
||||
if !found {
|
||||
r.Outputs[v] = make([]string, 0)
|
||||
if currentDebug {
|
||||
log.Debugf("Collapse mode found a new output:\n\"%s\"\n%v\n", hostOutput, []byte(hostOutput))
|
||||
}
|
||||
r.Outputs[hostOutput] = make([]string, 0)
|
||||
}
|
||||
r.Outputs[v] = append(r.Outputs[v], k)
|
||||
r.Outputs[hostOutput] = append(r.Outputs[hostOutput], host)
|
||||
}
|
||||
|
||||
return r
|
||||
|
||||
@@ -74,7 +74,7 @@ execLoop:
|
||||
continue
|
||||
}
|
||||
|
||||
w.data <- &Message{buf, MTDebug, task.Hostname, -1}
|
||||
w.data <- &Message{buf[:n], MTDebug, task.Hostname, -1}
|
||||
msgCount++
|
||||
|
||||
chunks := bytes.SplitAfter(buf[:n], []byte{'\n'})
|
||||
|
||||
@@ -154,7 +154,7 @@ func (w *Worker) run() {
|
||||
|
||||
// does the task have anything to run?
|
||||
if task.Cmd != "" {
|
||||
log.Debugf("WRK[%d] runcmd(%s) at %s", task.Cmd, task.Hostname)
|
||||
log.Debugf("WRK[%d] runcmd(%s) at %s", w.id, task.Cmd, task.Hostname)
|
||||
result = w.runcmd(task)
|
||||
w.data <- &Message{nil, MTExecFinished, task.Hostname, result}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user