Add CaptureFD for log testing (and some glog patterns)
authorAlexey Spiridonov <lesha@fb.com>
Thu, 26 Mar 2015 23:26:09 +0000 (16:26 -0700)
committerafrind <afrind@fb.com>
Thu, 2 Apr 2015 18:58:28 +0000 (11:58 -0700)
commit397a944bf9c0621a3b1b94f90efb7d0a60513ef0
tree151d703dc91f8accd7ed2569a72ef639d012f7ea
parent133fc50c97e7d3d81855fb9fedf034b1ad056feb
Add CaptureFD for log testing (and some glog patterns)

Summary:
Without a gadget like this, it's really hard to test logging output. With it, it's really easy. I found about 50 callsites to the various functions across several projects, so folly seems appropriate.

PS The patterns are functions for two reasons:
- Static variables are a pain.
- This leaves the option of adding an optional argument, so you can grep for a particular kind of error string.

Test Plan: unit test

Reviewed By: yfeldblum@fb.com

Subscribers: folly-diffs@, yfeldblum

FB internal diff: D1933439

Signature: t1:1933439:1427345479:5b3d1c6566a026fdbccb16b382211688e327ea1a
folly/experimental/TestUtil.cpp
folly/experimental/TestUtil.h
folly/experimental/test/TestUtilTest.cpp