Injecting code into methods based on UDA's

TheFlyingFiddle theflyingfiddle at gmail.com
Sat Oct 19 16:00:49 PDT 2013



void logMsg(string file, string msg)
{
   //Log the message to the file.
}

struct Log
{
    string logFile;
    LogInfo toLog;
}

class Foo
{
   void bar() { /* do something */ }
   @Log("fooInfo.txt", LogInfo.methodCall | LogInfo.returnValue)
void baz()
   {
     //Doess
   }
}


More information about the Digitalmars-d-learn mailing list