On Monday, 14 October 2013 at 12:40:16 UTC, Sönke Ludwig wrote:
Am 14.10.2013 13:39, schrieb Dicebot:
- For me this logger is completely worthless without any debug log levels. The last std.log entry had at least anonymous verbosity levels, but I'd prefer something like I did in vibe.d [1], where each level has a defined role. This should especially improve the situation when multiple libraries are involved.

Orthogonal to log levels one idea could be to define a namespace for a logger instance.

* The namespace could be in the form of a prefix (useful for grepping and simple to implement)

logger.setPrefix("myApi__");
logger.warn("a warning"); // would output "myApi__a warning"

* The namespace could be deduced from the module name and filtered at runtime by a flag 'à la' gtest ( https://code.google.com/p/googletest/wiki/AdvancedGuide#Running_a_Subset_of_the_Tests ). This would be helpful when displaying fine grained log for debugging purpose without being flooded by other libraries logs.

./foo Has no flag, and thus output all the logs.
./foo --log_namespace=myLyb.* Output everything in myLyb module.

This option requires initializing the test library in main and would be more costly because of the namespace matching ( maybe the initialization could trigger a different implementation at runtime or we enable this feature at compile time through a version )

Reply via email to