Created
February 10, 2017 12:55
-
-
Save jhonata-menezes/fad588bc422fe3f7b899ba82bb1f4c27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$logger = new Logger('name_app'); | |
$logger->pushProcessor(function(array $record){ | |
if($record['level_name'] >= Logger::ERROR){ | |
$record['context'] = debug_backtrace(); | |
} | |
$debug = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 10); | |
if(count($debug) >= 6 && isset($debug[6]['class'], $debug[6]['line'], $debug[6]['function'])){ | |
$record['level_name'] = sprintf('%s::%s', $debug[6]['class'], $debug[6]['function']);//add name class and function | |
} | |
return $record; | |
}); | |
//output | |
//2017-02-10 10:53:40 forseti-app.Forseti\App\Name\Class::functionName : my name not is Johnny |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment