You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?phprequire_once __DIR__.'/class-loader/ClassLoader.php';
useSymfony\Component\ClassLoader\ClassLoader;
$loader = newClassLoader();
$loader->register();
$loader->addPrefix('Psr\\Log', __DIR__);
$loader->addPrefix('Katzgrau\\KLogger', __DIR__);
$users = array(
array(
'name' => 'Kenny Katzgrau',
'username' => 'katzgrau',
),
array(
'name' => 'Dan Horrigan',
'username' => 'dhrrgn',
)
);
$logger = newKatzgrau\KLogger\Logger(__DIR__.'/logs');
$logger->info('Returned a million search results');
$logger->error('Oh dear.');
$logger->debug('Got these users from the Database.', $users);
Everything works fine under this conditions:
I do not debug
I do debug (Netbeans, XDebug) and step into new Katzgrau\KLogger\Logger()
It does not work, if I set a breakpoint before new Katzgrau\KLogger\Logger() and when the breakpoint is reached I click "Continue (F5)". Then I get this fatal error: Fatal error: Class declarations may not be nested in path\to\project\Psr\Log\LogLevel.php on line 9
I tried a lot to figure out what is going on. The only workaround I found was uncomment use Psr\Log\LogLevel; in Logger.php and copy the class definition of Psr\Log\Level directly into Logger.php (that's why I am posting it here).
But for obvious reasons I don't want to modify your code this way.
Does anyone know what and why is this happening?
Thanks a lot!
Regards
The text was updated successfully, but these errors were encountered:
Yeah, not really a KLogger problem. At least the problem seems limited to debugging and setting a breakpoint at a specific place. It could be a potential issue with xdebug. I would check php's error_log to see if there's anything more specific in there.
Hi there,
first I want to apologize if this not the right place to post this ... :-( I am using KLogger and PSR Log (https://github.com/php-fig/log) together with Symfony's ClassLoader Component (https://github.com/symfony/class-loader) to autoload KLogger and PSR Log.
My test code looks like this:
Everything works fine under this conditions:
new Katzgrau\KLogger\Logger()
It does not work, if I set a breakpoint before
new Katzgrau\KLogger\Logger()
and when the breakpoint is reached I click "Continue (F5)". Then I get this fatal error:Fatal error: Class declarations may not be nested in path\to\project\Psr\Log\LogLevel.php on line 9
I tried a lot to figure out what is going on. The only workaround I found was uncomment
use Psr\Log\LogLevel;
in Logger.php and copy the class definition of Psr\Log\Level directly into Logger.php (that's why I am posting it here).But for obvious reasons I don't want to modify your code this way.
Does anyone know what and why is this happening?
Thanks a lot!
Regards
The text was updated successfully, but these errors were encountered: