summaryrefslogtreecommitdiffstats
path: root/modules/ssh
diff options
context:
space:
mode:
authorGabriel Jackson <gabriel@coffeepowered.co>2017-01-29 12:13:57 -0800
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-02-02 15:24:18 +0100
commitbf6f61cc690978bcad416ace8e8da2418602cbf3 (patch)
tree98be4a5abcd53063b41676772b8dd37a47621c44 /modules/ssh
parent73d05a51e3dce4a5b31b8660a6141a14ae615404 (diff)
downloadgitea-bf6f61cc690978bcad416ace8e8da2418602cbf3.tar.gz
gitea-bf6f61cc690978bcad416ace8e8da2418602cbf3.zip
Cleanup log messaging
This change corrects a few logging issues: * Standardized formatting errors with '%v'. * Standardized failure warning word usage. * Corrected an instance of using the standard log library when the gitea log library should be used instead.
Diffstat (limited to 'modules/ssh')
-rw-r--r--modules/ssh/ssh.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/ssh/ssh.go b/modules/ssh/ssh.go
index 18bac8dbf2..36a383fa86 100644
--- a/modules/ssh/ssh.go
+++ b/modules/ssh/ssh.go
@@ -5,7 +5,6 @@
package ssh
import (
- "fmt"
"io"
"io/ioutil"
"net"
@@ -117,7 +116,7 @@ func handleServerConn(keyID string, chans <-chan ssh.NewChannel) {
func listen(config *ssh.ServerConfig, host string, port int) {
listener, err := net.Listen("tcp", host+":"+com.ToStr(port))
if err != nil {
- log.Fatal(4, "Fail to start SSH server: %v", err)
+ log.Fatal(4, "Failed to start SSH server: %v", err)
}
for {
// Once a ServerConfig has been configured, connections can be accepted.
@@ -169,23 +168,23 @@ func Listen(host string, port int) {
filePath := filepath.Dir(keyPath)
if err := os.MkdirAll(filePath, os.ModePerm); err != nil {
- log.Error(4, "Fail to create dir %s: %v", filePath, err)
+ log.Error(4, "Failed to create dir %s: %v", filePath, err)
}
_, stderr, err := com.ExecCmd("ssh-keygen", "-f", keyPath, "-t", "rsa", "-N", "")
if err != nil {
- panic(fmt.Sprintf("Fail to generate private key: %v - %s", err, stderr))
+ log.Fatal(4, "Failed to generate private key: %v - %s", err, stderr)
}
log.Trace("SSH: New private key is generateed: %s", keyPath)
}
privateBytes, err := ioutil.ReadFile(keyPath)
if err != nil {
- panic("SSH: Fail to load private key")
+ log.Fatal(4, "SSH: Failed to load private key")
}
private, err := ssh.ParsePrivateKey(privateBytes)
if err != nil {
- panic("SSH: Fail to parse private key")
+ log.Fatal(4, "SSH: Failed to parse private key")
}
config.AddHostKey(private)