Skip to content

Commit

Permalink
Change all log.Printz to log.Errorf
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkren committed Jul 15, 2019
1 parent 15fe824 commit 6881d17
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions internal/therealssh/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"log"
"net"
"os"
"os/user"
Expand Down Expand Up @@ -176,7 +175,7 @@ func (sshCh *SSHChannel) ServeSocket() error {

go func() {
if _, err := io.Copy(sshCh, conn); err != nil && !strings.Contains(err.Error(), "use of closed network connection") {
log.Println("failed to write to server:", err)
sshCh.log.Errorf("failed to write to server:", err)
return
}
}()
Expand Down Expand Up @@ -217,7 +216,7 @@ func (sshCh *SSHChannel) Start(command string) error {

go func() {
if err := sshCh.serveSession(); err != nil {
log.Println("Session failure:", err)
sshCh.log.Errorf("Session failure:", err)
}
}()

Expand All @@ -233,7 +232,7 @@ func (sshCh *SSHChannel) serveSession() error {

go func() {
if _, err := io.Copy(sshCh.session, sshCh); err != nil {
log.Println("PTY copy: ", err)
sshCh.log.Errorf("PTY copy: ", err)
return
}
}()
Expand Down
2 changes: 1 addition & 1 deletion internal/therealssh/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func (rpc *RPCClient) Exec(args *ExecArgs, socketPath *string) error {
rpc.c.log.Debugln("starting socket listener")
waitCh <- true
if err := sshCh.ServeSocket(); err != nil {
log.Println("Session failure:", err)
sshCh.log.Errorf("Session failure:", err)
}
}()

Expand Down
5 changes: 2 additions & 3 deletions internal/therealssh/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"log"
"net"

"github.com/skycoin/dmsg/cipher"
Expand Down Expand Up @@ -88,7 +87,7 @@ func (s *Server) OpenChannel(remoteAddr *app.Addr, remoteID uint32, conn net.Con
go func() {
s.log.Debugln("listening for channel requests")
if err := channel.Serve(); err != nil {
log.Println("channel failure:", err)
s.log.Errorf("channel failure:", err)
}
}()

Expand All @@ -104,7 +103,7 @@ func (s *Server) HandleRequest(remotePK cipher.PubKey, localID uint32, data []by

if s.auth.Authorize(remotePK) != nil || channel.RemoteAddr.PubKey != remotePK {
if err := channel.Send(CmdChannelResponse, responseUnauthorized); err != nil {
log.Println("failed to send response: ", err)
s.log.Errorf("failed to send response: ", err)
}
return nil
}
Expand Down

0 comments on commit 6881d17

Please sign in to comment.