Skip to content

Commit

Permalink
Merge pull request #6 from k1LoW/syslog
Browse files Browse the repository at this point in the history
Support syslog output
  • Loading branch information
k1LoW authored Feb 3, 2021
2 parents 7988dfd + a162354 commit 05dc926
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/updateAuthorizedKeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"fmt"
"io/ioutil"
"log"
"log/syslog"
"os"
"os/user"
"path/filepath"
Expand All @@ -47,6 +48,12 @@ var updateAuthorizedKeysCmd = &cobra.Command{
log.SetOutput(os.Stdout)
case logTo == "stderr":
log.SetOutput(os.Stderr)
case logTo == "syslog":
l, err := syslog.New(syslog.LOG_NOTICE|syslog.LOG_USER, "keyp")
if err != nil {
return err
}
log.SetOutput(l)
case logTo != "":
l, err := os.OpenFile(filepath.Clean(logTo), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644) // #nosec
if err != nil {
Expand Down

0 comments on commit 05dc926

Please sign in to comment.