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 (
"errors"
"fmt"
"io"
"log"
"os"
@ -12,7 +11,7 @@ import (
)
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)
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 {
fmt.Printf(" restore dir %q\n", target)
log.Printf(" restore dir %q\n", target)
rd, err := repo.Get(khepri.TYPE_BLOB, id)
if err != nil {
return err
@ -132,7 +131,7 @@ func commandRestore(repo *khepri.Repository, args []string) error {
return err
}
fmt.Printf("%q restored to %q\n", id, target)
log.Printf("%q restored to %q\n", id, target)
return nil
}

View File

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