summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2020-06-15 19:17:41 +0700
committerShulhan <m.shulhan@gmail.com>2020-06-15 19:18:10 +0700
commitf370c2a598d3b4482e2d391458fc6878fada49af (patch)
tree66407e98a9d154bc34891baa70b96a897991eed1
parentfbf3d88264b7177da4eb1596480138d88eff8c98 (diff)
downloadawwan-f370c2a598d3b4482e2d391458fc6878fada49af.tar.xz
command: log the put and get commands on local and remote
-rw-r--r--command.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/command.go b/command.go
index d2f9634..cd6a86f 100644
--- a/command.go
+++ b/command.go
@@ -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 {