Skip to content

Commit

Permalink
fix log format (#21773)
Browse files Browse the repository at this point in the history
  • Loading branch information
keisku authored Dec 27, 2023
1 parent b374362 commit 4a066e8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/gohai/processes/gops/process_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,25 @@ func GetProcesses() ([]*ProcessInfo, error) {

virtMemStat, err := mem.VirtualMemory()
if err != nil {
err = fmt.Errorf("error fetching system memory stats: %w", err)
return nil, err
return nil, fmt.Errorf("error fetching system memory stats: %w", err)
}
totalMem := float64(virtMemStat.Total)

pids, err := process.Pids()
if err != nil {
err = fmt.Errorf("error fetching PIDs: %w", err)
return nil, err
return nil, fmt.Errorf("error fetching PIDs: %w", err)
}

for _, pid := range pids {
p, err := process.NewProcess(pid)
if err != nil {
// an error can occur here only if the process has disappeared,
log.Debugf("Process with pid %d disappeared while scanning: %w", pid, err)
log.Debugf("Process with pid %d disappeared while scanning: %s", pid, err)
continue
}
processInfo, err := newProcessInfo(p, totalMem)
if err != nil {
log.Debugf("Error fetching info for pid %d: %w", pid, err)
log.Debugf("Error fetching info for pid %d: %s", pid, err)
continue
}

Expand Down

0 comments on commit 4a066e8

Please sign in to comment.