Reviewers: r,
Message:
Hello r (cc:
golan...@googlegroups.com),
I'd like you to review this change.
Description:
log: add Wtf and Wtff for logging terrible failures.
cf
http://developer.android.com/reference/android/util/Log.html
Please review this at
http://codereview.appspot.com/1257044/show
Affected files:
M src/pkg/log/log.go
Index: src/pkg/log/log.go
===================================================================
--- a/src/pkg/log/log.go
+++ b/src/pkg/log/log.go
@@ -56,6 +56,7 @@
var (
stdout = New(os.Stdout, nil, "", Lok|Ldate|Ltime)
stderr = New(os.Stderr, nil, "", Lok|Ldate|Ltime)
+ wtf = New(os.Stderr, nil, "wtf? ", Lok)
exit = New(os.Stderr, nil, "", Lexit|Ldate|Ltime)
crash = New(os.Stderr, nil, "", Lcrash|Ldate|Ltime)
)
@@ -162,12 +163,20 @@
// Stderr is a helper function for easy logging to stderr. It is analogous
to Fprint(os.Stderr).
func Stderr(v ...interface{}) { stderr.Output(2, fmt.Sprintln(v)) }
+// Wtf is a helper function for logging to stderr. It is analogous to
Fprint(os.Stderr),
+// but with output prefixed by the string "wtf?". "wtf" is an acronym
for "what a terrible failure"
+func Wtf(v ...interface{}) { wtf.Output(2, fmt.Sprintln(v)) }
+
// Stdoutf is a helper functions for easy formatted logging to stdout. It
is analogous to Printf().
func Stdoutf(format string, v ...interface{}) { stdout.Output(2,
fmt.Sprintf(format, v)) }
// Stderrf is a helper function for easy formatted logging to stderr. It
is analogous to Fprintf(os.Stderr).
func Stderrf(format string, v ...interface{}) { stderr.Output(2,
fmt.Sprintf(format, v)) }
+// Wtff is a helper function for formatted logging to stderr. It is
analogous to Fprintf(os.Stderr),
+// but with output prefixed by the string "wtf?". "wtf" is an acronym
for "what a terrible failure"
+func Wtff(format string, v ...interface{}) { wtf.Output(2,
fmt.Sprintf(format, v)) }
+
// Exit is equivalent to Stderr() followed by a call to os.Exit(1).
func Exit(v ...interface{}) { exit.Output(2, fmt.Sprintln(v)) }