mirror of
https://github.com/restic/restic.git
synced 2025-12-10 05:31:49 +00:00
Use different tags for debug log
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// +build debug
|
||||
// +build debug_cmd
|
||||
|
||||
package main
|
||||
|
||||
@@ -17,8 +17,8 @@ func initDebugLogger() *log.Logger {
|
||||
// create new log file
|
||||
filename := fmt.Sprintf("khepri-debug-%d-%s",
|
||||
os.Getpid(), time.Now().Format("20060201-150405"))
|
||||
f, err := os.OpenFile(filepath.Join(os.TempDir(), filename),
|
||||
os.O_WRONLY|os.O_CREATE, 0600)
|
||||
path := filepath.Join(os.TempDir(), filename)
|
||||
f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0600)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "unable to create debug log file: %v", err)
|
||||
os.Exit(2)
|
||||
@@ -26,7 +26,7 @@ func initDebugLogger() *log.Logger {
|
||||
|
||||
// open logger
|
||||
l := log.New(io.MultiWriter(os.Stderr, f), "DEBUG: ", log.LstdFlags)
|
||||
fmt.Fprintf(os.Stderr, "logging activated, writing log file %s\n", filename)
|
||||
fmt.Fprintf(os.Stderr, "debug log for khepri command activated, writing log file %s\n", path)
|
||||
l.Printf("khepri %s", version)
|
||||
|
||||
return l
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build !debug
|
||||
// +build !debug_cmd
|
||||
|
||||
package main
|
||||
|
||||
|
||||
Reference in New Issue
Block a user