log smudge errors
This commit is contained in:
parent
a3795ffb51
commit
f960932fa6
@ -53,7 +53,7 @@ func smudgeCommand(cmd *cobra.Command, args []string) {
|
||||
|
||||
if err != nil {
|
||||
ptr.Encode(os.Stdout)
|
||||
Error("Error accessing media: %s (%s)", filename, ptr.Oid)
|
||||
LoggedError(err, "Error accessing media: %s (%s)", filename, ptr.Oid)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,15 +59,21 @@ func Debug(format string, args ...interface{}) {
|
||||
log.Printf(format, args...)
|
||||
}
|
||||
|
||||
// Panic prints a formatted message, and writes a stack trace for the error to
|
||||
// a log file before exiting.
|
||||
func Panic(err error, format string, args ...interface{}) {
|
||||
// LoggedError prints a formatted message to Stderr and writes a stack trace for
|
||||
// the error to a log file without exiting.
|
||||
func LoggedError(err error, format string, args ...interface{}) {
|
||||
Error(format, args...)
|
||||
file := handlePanic(err)
|
||||
|
||||
if len(file) > 0 {
|
||||
fmt.Fprintf(os.Stderr, "\nErrors logged to %s.\nUse `git media logs last` to view the log.\n", file)
|
||||
}
|
||||
}
|
||||
|
||||
// Panic prints a formatted message, and writes a stack trace for the error to
|
||||
// a log file before exiting.
|
||||
func Panic(err error, format string, args ...interface{}) {
|
||||
LoggedError(err, format, args...)
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user