5

When I am running approval tests some debug output from approval test gets to my logs. It looks like 2/15/2016 1:58:48 PM ~000002ms Variable: approvalFrame = '' 2/15/2016 1:58:48 PM ~000025ms Variable: approvalFrame = '' 2/15/2016 1:58:48 PM ~000003ms Variable: approvalFrame = '' 2/15/2016 1:58:48 PM ~000002ms Variable: approvalFrame = '......

Is there any way to hide it from logs?

Thanks.

the_joric
  • 11,986
  • 6
  • 36
  • 57

1 Answers1

6

ApprovalTests uses the SimpleLogger for logging. If you set it to null it won't log to your files. If you want to use the SimpleLogger afterwards, reset it.

 ApprovalUtilities.SimpleLogger.Logger.Writer = NullWriter.Instance;

To reset

Logger.Writer = new MultiWriter(new ConsoleWriter(),new DebugerWriter());

There are lot's of other writers of course and you can make your own composites or very own versions as well.

Happy Testing!

llewellyn falco
  • 2,281
  • 16
  • 13
  • @llewellyn_falco thanks -- one more question then. Where is the best place to put that code? Kind of Approvals bootstrapper or something? – the_joric Feb 16 '16 at 13:47
  • 1
    good question. I usually have a sort of setup thing / config thing for most of my projects. If it's bothersome you could make a base test class, or sneak it into a custom reporter initializer. There isn't really a approvals bootstrapper at the moment. – llewellyn falco Dec 12 '16 at 16:48