lundi 25 avril 2016

Golang Log granularity for test logs

Main question

How should one stratify logs in a large golang testing suite?*

Background

In golang, the test package has its own logging interface.

http://ift.tt/1SnkcYI

For idiomatic go testing, you need to use the golang test logger at least some, but you also (for complex test libraries) sometimes you want to stratify you're logs using levels, packages, etc...

Root question

Is there a way to have package or V(...) semantics in test logs.

Workaround

One workaround is to use both glog and Log in tests, using glog for non critical logs and T.Log for the test specific progress. But that forces the use of two logging libraries which, in and of itself, is a little strange to wrangle.

Aucun commentaire:

Enregistrer un commentaire