Skip to content

Commit 1241a03

Browse files
authored
Improve display of stdout/stderr for command (#35)
Update `git-xargs` to write the `stdout` / `stderr` from the command directly to the logs, as plain text, rather than using structured logging / logrus fields. The problem with using fields, as we did before, is the log output gets shoved into JSON, with all sorts of characters escaped (e.g., newlines become `\n`), which makes it hard to read the log output when debugging.
1 parent 0fcd89a commit 1241a03

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

repository/repo-operations.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ func executeCommandWithLogger(config *config.GitXargsConfig, repositoryDir strin
111111

112112
stdoutStdErr, err := cmd.CombinedOutput()
113113

114-
logger.WithFields(logrus.Fields{
115-
"CombinedOutput": string(stdoutStdErr),
116-
}).Debug("Received output of command run")
114+
logger.Debugf("Output of command %v for repo %s in directory %s:\n%s", config.Args, repo.GetName(), repositoryDir, string(stdoutStdErr))
117115

118116
if err != nil {
119117
logger.WithFields(logrus.Fields{

0 commit comments

Comments
 (0)