Early review of std.logger

Tavi Cacina octavian.cacina at outlook.com
Mon Nov 4 13:31:50 PST 2013


On Monday, 4 November 2013 at 13:46:58 UTC, Dicebot wrote:
> Ok, finally making some conclusions.

Sorry if late or already discussed: I think would be useful to 
provide a way to define the default logger module-wise. Something 
like:

// myapp/feature.d
module myapp.feature;
import std.logging;

// define the log category for this module
mixin LogCategory!("myapp.feature");

/* The LogCategory would inject something like:
   ref Logger logger(LogLevel level)
   {
     find the first in this order
       LogManager.logger("myapp.feature"),
       LogManager.logger("myapp"),
       LogManager.defaultLogger();
   }
*/

void fun()
{
   warn("ups");
   // the std.logging.warn() should get the Logger from
   // the current module's function 'logger' or a default one.
}



More information about the Digitalmars-d mailing list