Better foreground logging (printing).
Better foreground logging (printing).

When run in the foreground, you'll see printed messages.  For non-errors
receiving metrics, you'll still see one line printed per metric received,
but it will include the metric value parts as well.

If there's an error on metric receipt, you'll see that as well (without having
to enable "debug" in the config file.  This is in the spirit of seeing some
output printed regardless of the "debug" value in the config.  Plus, this way
you won't miss StatsD packet decoding errors (which should be rare) if you
ran the daemon with "-f" but didn't have debugging enabled.

Sample foreground output from running genevent.py:

Running in foreground.
got key: comb_testitem ['1', 'c']
got key: ctest2 ['4', 'c']
got key: ctimertest1 ['200', 'ms']
got key: ctestitem1 ['1', 'c', '@0.5']
got key: gtest ['100', 'g']
got key: gtest ['99', 'g']
got key: testitem ['1', 'c']
got key: testitem ['1', 'c', '@0.5']
got key: timertest ['300', 'ms']
got key: timertest ['400', 'ms']
got key: timertest ['500', 'ms']
error: invalid request [.]
error: invalid request [ ]
error (): not enough fields received
got key: _ [' ', 'c']
error: unsupported stats type
key -> baditem
fields ->['1', 'k']
got key: baditem ['1', 'c', '@']
got key: baditem ['1', 'c', '@wtf']
got key: baditem ['1', 'c', '@05f.6']
got key: badtimer ['5.0f', 'ms']
got key: badgauge ['K', 'g']
error: ce72b7e3a91320eee8ec3f9b6da62408ed154671@#%th'is^&*be"ok]
got key: gtest ['99', 'g']
...

pandemicsyn/statsdpy