After getting my first output from FLOW3 yesterday I continued my tests and gave aspects a try. It took my some time to get my aspect running but eventually it worked out.
Same as the first "Hello Worl" test, this test is fairly simple. All I do is, definig an aspect called "AspectTest" (Yeah... This some fancy kind of a name) which is executed around every method in all classes beginning with "T3_ThomasTest_":
/** * Advice to check if the static function is proxied correctly (will result in a fatal error * if it doesn't) * * @around method(T3_ThomasTest_.*->.*()) */ public function someTestAdvice(T3_FLOW3_AOP_JoinPointInterface $joinPoint) { $returnResult = $joinPoint->getAdvicechain()->proceed($joinPoint); $logMessage = $joinPoint->getClassName().'->'.$joinPoint->getMethodName().' execution time: '.(($endTime -$startTime)*1000).'ms'; $this->logger->log($logMessage, T3_Log_LoggerInterface::SEVERITY_DEBUG); return $returnResult; }
What the advice actually does is nothing outstanding. Before the target method is executed, it stores the timestamp in a variable. The next step is to process the advice chain which means, that all other advices at this point are exceuted until the target method is reached. The result is passed through the calls and eventually arrives our advice.
When it arrives, the timestamp is stored again and the difference between both timestamps is calculated and written to a logmessage.
This logmessage is than handed over to the Logger Interface. How it is processed further is not decided by the advice because we only "talk" to a generic Logger interface. The final implenetation of the logging mechanism has to be configured via a Components.ini file. In my case I configured the usage of the "SimpleFileLogger" Because it's the only implemeted Logging mechanism yet.
You can download the complete "ThomasTest" package at the end of this article.
Greets,
Thomas
#2: Thomas commented on Saturday, 23-02-08 18:17
Hi Tim,
which browser do you use. It looks fine on Safari and Firefox on my systems. ^^
Greets,
Thomas
#3: Tschüge commented on Sunday, 24-02-08 10:55
Hallo,
Ich wollte FLOW3 auch mal testen, kann aber nirgends einen Download-Link finden. Kannst Du mir ev. weiter helfen?
Besten Dank
Tschüge
#4: Thomas commented on Monday, 25-02-08 09:11
Hi,
you have to checkout FLOW3 from subversion because there is no distribution package available yet. See flow3.typo3.org for details.
Greets,
Thomas
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jan | Mar » | |||||
| 1 | 2 | 3 | ||||
| 4 | 5 | 06 | 7 | 08 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | ||
Very interesting articles. Nice graph: ) Note 4 Your blog is 8/10: D
Good blog. Nice articles. It's very interesting...
Good blog. Nice articles. It's very interesting...
Very Nice Blog!
Thanks, Thomas. This is a big help. Some folks might need to know that when they are setting up the ...
#1: Tim commented on Friday, 22-02-08 18:50
Hi Thomas,
a overflow:scroll for pre Tags will fix the Code Block ;-)
Looks strange...
Regards,
Tim