From 1fdf763d0f5ddd6e2541a0b825dfce1ed13b61c2 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Mon, 21 May 2018 11:25:51 -0700 Subject: [PATCH] fancier logging --- common/shell-local/communicator.go | 2 +- common/shell-local/run.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/shell-local/communicator.go b/common/shell-local/communicator.go index b51d309d9..4055c96b5 100644 --- a/common/shell-local/communicator.go +++ b/common/shell-local/communicator.go @@ -21,7 +21,7 @@ func (c *Communicator) Start(cmd *packer.RemoteCmd) error { } // Build the local command to execute - log.Printf("Executing local shell command %s", c.ExecuteCommand) + log.Printf("[INFO] (shell-local communicator): Executing local shell command %s", c.ExecuteCommand) localCmd := exec.Command(c.ExecuteCommand[0], c.ExecuteCommand[1:]...) localCmd.Stdin = cmd.Stdin localCmd.Stdout = cmd.Stdout diff --git a/common/shell-local/run.go b/common/shell-local/run.go index 6af406522..0457536fa 100644 --- a/common/shell-local/run.go +++ b/common/shell-local/run.go @@ -62,7 +62,7 @@ func Run(ui packer.Ui, config *Config) (bool, error) { // buffers and for reading the final exit status. flattenedCmd := strings.Join(interpolatedCmds, " ") cmd := &packer.RemoteCmd{Command: flattenedCmd} - log.Printf("starting local command: %s", flattenedCmd) + log.Printf("[INFO] (shell-local): starting local command: %s", flattenedCmd) if err := cmd.StartWithUi(comm, ui); err != nil { return false, fmt.Errorf( @@ -92,7 +92,7 @@ func createInlineScriptFile(config *Config) (string, error) { writer := bufio.NewWriter(tf) if config.InlineShebang != "" { shebang := fmt.Sprintf("#!%s\n", config.InlineShebang) - log.Printf("Prepending inline script with %s", shebang) + log.Printf("[INFO] (shell-local): Prepending inline script with %s", shebang) writer.WriteString(shebang) } for _, command := range config.Inline { @@ -108,7 +108,7 @@ func createInlineScriptFile(config *Config) (string, error) { tf.Close() err = os.Chmod(tf.Name(), 0555) if err != nil { - log.Printf("error modifying permissions of temp script file: %s", err.Error()) + log.Printf("[ERROR] (shell-local): error modifying permissions of temp script file: %s", err.Error()) } return tf.Name(), nil }