diff options
| author | Shulhan <m.shulhan@gmail.com> | 2020-06-15 19:17:41 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2020-06-15 19:18:10 +0700 |
| commit | f370c2a598d3b4482e2d391458fc6878fada49af (patch) | |
| tree | 66407e98a9d154bc34891baa70b96a897991eed1 | |
| parent | fbf3d88264b7177da4eb1596480138d88eff8c98 (diff) | |
| download | awwan-f370c2a598d3b4482e2d391458fc6878fada49af.tar.xz | |
command: log the put and get commands on local and remote
| -rw-r--r-- | command.go | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -265,6 +265,7 @@ func (cmd *Command) executeLocalScript() { continue } if bytes.HasPrefix(stmt, cmdMagicPut) { + log.Printf(">>> %3d: %s\n", x, stmt) err := cmd.copy(stmt) if err != nil { break @@ -272,6 +273,7 @@ func (cmd *Command) executeLocalScript() { continue } if bytes.HasPrefix(stmt, cmdMagicSudoPut) { + log.Printf(">>> %3d: %s\n", x, stmt) err := cmd.sudoCopy(stmt) if err != nil { break @@ -279,6 +281,7 @@ func (cmd *Command) executeLocalScript() { continue } if bytes.HasPrefix(stmt, cmdMagicGet) { + log.Printf(">>> %3d: %s\n", x, stmt) err := cmd.copy(stmt) if err != nil { break @@ -286,6 +289,7 @@ func (cmd *Command) executeLocalScript() { continue } if bytes.HasPrefix(stmt, cmdMagicSudoGet) { + log.Printf(">>> %3d: %s\n", x, stmt) err := cmd.sudoCopy(stmt) if err != nil { break @@ -296,7 +300,7 @@ func (cmd *Command) executeLocalScript() { continue } - log.Printf(">>> local %d: %s\n\n", x, stmt) + log.Printf(">>> %3d: %s\n\n", x, stmt) err := exec.Run(string(stmt), os.Stdout, os.Stderr) if err != nil { @@ -337,6 +341,7 @@ func (cmd *Command) executeScript() { continue } if bytes.HasPrefix(stmt, cmdMagicPut) { + log.Printf(">>> %s: %3d: %s\n\n", cmd.sshClient, x, stmt) err := cmd.put(stmt) if err != nil { break @@ -344,6 +349,7 @@ func (cmd *Command) executeScript() { continue } if bytes.HasPrefix(stmt, cmdMagicSudoPut) { + log.Printf(">>> %s: %3d: %s\n\n", cmd.sshClient, x, stmt) err := cmd.sudoPut(stmt) if err != nil { break @@ -351,6 +357,7 @@ func (cmd *Command) executeScript() { continue } if bytes.HasPrefix(stmt, cmdMagicGet) { + log.Printf(">>> %s: %3d: %s\n\n", cmd.sshClient, x, stmt) err := cmd.get(stmt) if err != nil { break @@ -358,6 +365,7 @@ func (cmd *Command) executeScript() { continue } if bytes.HasPrefix(stmt, cmdMagicSudoGet) { + log.Printf(">>> %s: %3d: %s\n\n", cmd.sshClient, x, stmt) err := cmd.sudoGet(stmt) if err != nil { break @@ -368,7 +376,7 @@ func (cmd *Command) executeScript() { continue } - log.Printf(">>> %s: %d: %s\n\n", cmd.sshClient, x, stmt) + log.Printf(">>> %s: %3d: %s\n\n", cmd.sshClient, x, stmt) err := cmd.sshClient.Execute(string(stmt)) if err != nil { |
