Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LogAdapter
- {
- public static function log($event)
- {
- $bt = debug_backtrace();
- $index = null;
- foreach($bt as $idx => $trace) {
- if($trace['class'] == 'LogAdapter') {
- $index = $idx;
- }
- }
- echo $event . ' Class : ' . $bt[$index + 1]['class'] . ', line : ', $bt[0]['line'] . ', file : ' . $bt[$index + 1]['file'] . '<br />';
- }
- }
- class TestC
- {
- public static function test()
- {
- LogAdapter::log('Event 2');
- }
- }
- class TestB {
- public static function test()
- {
- LogAdapter::log('Event 1');
- TestC::test();
- LogAdapter::log('Event 3');
- }
- }
- TestB::test();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement