Implementing std.log

Kagamin spam at here.lot
Thu Apr 21 10:50:55 PDT 2011


Denis Koroskin Wrote:

> Having different loggers for different parts of programs (e.g. separate  
> logger for my rendering, separate one for audio, separate for physics, and  
> so on) is a must for me.
> Because when you debug your code by analyzing log output, you want to be  
> able to filter out non-relevant stuff. If you only have ONE logger, you  
> will start adding stupid prefixes like this:
> 
> error("GAME/GAMEMODE_CHALLENGE/OBJECTIVE_CHECKER: match data frame is not  
> valid");
> 
> instead of
> 
> log.error("match data frame is not valid");

If you parameterize logger with just a class name, that's not enough. log4net uses similar approach, and I constantly need to prefix log messages with method name, its signature and sometimes even line number to know, where the logging took place. If I don't do this, it's difficult to determine where it blew up just by the class name because there're many identical log calls throughout a class.


More information about the Digitalmars-d mailing list