How to disable log package's output when testing?

4,535 views
Skip to first unread message

dlin

unread,
May 8, 2013, 7:35:03 AM5/8/13
to golan...@googlegroups.com
My function use "log" package to output some logs.
I've written a myfunc_test.go.
And I wish don't printout the log output if -test.v is not turn on.
Is that possible?

Or, just disable the "log" output when I'm running testing to simplified the test output.

dlin

unread,
May 8, 2013, 7:39:57 AM5/8/13
to golan...@googlegroups.com
Am I right? just put this line in the TestMyFunc()

log.SetOutput(ioutil.Discard)

Aaron France

unread,
May 8, 2013, 7:46:19 AM5/8/13
to dlin, golang-nuts
That will work.


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages