|
|
Descriptionlog: add Wtf and Wtff for logging terrible failures.
cf http://developer.android.com/reference/android/util/Log.html
Patch Set 1 #Patch Set 2 : code review 1257044: log: add Wtf and Wtff for logging terrible failures. #MessagesTotal messages: 9
Hello r (cc: golang-dev@googlegroups.com), I'd like you to review this change.
Sign in to reply to this message.
I don't understand. Are you just looking for another category of log? -rob On May 23, 2010, at 6:01 PM, stephenm@golang.org wrote: > Reviewers: r, > > Message: > Hello r (cc: golang-dev@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)) } > > >
Sign in to reply to this message.
2010/5/24 Rob 'Commander' Pike <r@google.com>: > I don't understand. Are you just looking for another category of log? I'm pretty sure it's a gag. "WTF" is clearly known to mean "What The Fuck". I see no merit in seriously adding this to the standard library. --dho > -rob > > On May 23, 2010, at 6:01 PM, stephenm@golang.org wrote: > >> Reviewers: r, >> >> Message: >> Hello r (cc: golang-dev@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)) } >> >> >> > >
Sign in to reply to this message.
Very cute, but I wouldn't want to read code that uses this. On 23 May 2010 18:01, <stephenm@golang.org> wrote: > Reviewers: r, > > Message: > Hello r (cc: golang-dev@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)) } > > > >
Sign in to reply to this message.
On May 24, 2010, at 11:01 AM, Andrew Gerrand wrote: > Very cute, but I wouldn't want to read code that uses this. i have two questions. 1) what is it really for? 2) assuming it's worthwhile, what name should it have? -rob
Sign in to reply to this message.
> 1) what is it really for? It's only there because I didn't want android to have the cute function named "wtf". It doesn't actually do anything useful. - S
Sign in to reply to this message.
> It's only there because I didn't want android to have the cute > function named "wtf". That should read "I didn't want android to be the only one to have the cute function named 'wtf'".
Sign in to reply to this message.
On May 25, 2010, at 5:40 PM, Stephen Ma wrote: >> It's only there because I didn't want android to have the cute >> function named "wtf". > > That should read "I didn't want android to be the only one to have the > cute function named 'wtf'". I don't consider it a cute name. -rob
Sign in to reply to this message.
|
