2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-25 22:27:35 +00:00

Fix logging

This commit is contained in:
Alexander Neumann 2014-08-05 23:13:07 +02:00
parent ad8125d83c
commit f45a9c8e9f
2 changed files with 6 additions and 4 deletions

View File

@ -2,7 +2,6 @@ package main
import ( import (
"errors" "errors"
"fmt"
"io" "io"
"log" "log"
"os" "os"
@ -12,7 +11,7 @@ import (
) )
func restore_file(repo *khepri.Repository, node khepri.Node, target string) error { func restore_file(repo *khepri.Repository, node khepri.Node, target string) error {
fmt.Printf(" restore file %q\n", target) log.Printf(" restore file %q\n", target)
rd, err := repo.Get(khepri.TYPE_BLOB, node.Content) rd, err := repo.Get(khepri.TYPE_BLOB, node.Content)
if err != nil { if err != nil {
@ -49,7 +48,7 @@ func restore_file(repo *khepri.Repository, node khepri.Node, target string) erro
} }
func restore_dir(repo *khepri.Repository, id khepri.ID, target string) error { func restore_dir(repo *khepri.Repository, id khepri.ID, target string) error {
fmt.Printf(" restore dir %q\n", target) log.Printf(" restore dir %q\n", target)
rd, err := repo.Get(khepri.TYPE_BLOB, id) rd, err := repo.Get(khepri.TYPE_BLOB, id)
if err != nil { if err != nil {
return err return err
@ -132,7 +131,7 @@ func commandRestore(repo *khepri.Repository, args []string) error {
return err return err
} }
fmt.Printf("%q restored to %q\n", id, target) log.Printf("%q restored to %q\n", id, target)
return nil return nil
} }

View File

@ -2,6 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"log"
"os" "os"
"sort" "sort"
"strings" "strings"
@ -36,6 +37,8 @@ func init() {
} }
func main() { func main() {
log.SetOutput(os.Stdout)
Opts.Repo = os.Getenv("KHEPRI_REPOSITORY") Opts.Repo = os.Getenv("KHEPRI_REPOSITORY")
if Opts.Repo == "" { if Opts.Repo == "" {
Opts.Repo = "khepri-backup" Opts.Repo = "khepri-backup"