Following the dashboard logging docs. I have created this files:
AppLog.php
<?php
namespace mydash\AppLog;
class AppLog extends \koolreport\dashboard\Log
{
protected function settings()
{
return [
"mychannel"=>[
'chromePHP'=>[
'chromePHPHandler'=>new ChromePHPHandler(Logger::DEBUG, true, 8),
'level'=>'debug'
],
"rotatingFile"=>[
"filename"=>"/tmp/dash.log",
"maxFiles"=>2,
"level"=>"debug",
"buddle"=>true,
"filePermission"=>null,
"useLocking"=>false
]
]
];
}
}
UserChart.php
<?php
use \koolreport\dashboard\widgets\google\DonutChart;
use \koolreport\dashboard\fields\Text;
use \mydash\AppLog;
class UsersChart extends DonutChart
{
protected function onCreated()
{
$this->title('Gráfico de usuários');
AppLog::debug('Usuarios'); // <-- This line makes it stop working
}
protected function dataSource()
{
/*return AutoMaker::table('portal_users')
->select('IF(active = 0, "Inativo", "Ativo")')->label('label')
->groupBy('active')
->count('active')->alias('total');*/
return AutoMaker::rawSQL('
SELECT COUNT(*) total, IF(active = 0, "Inativo", "Ativo") label
FROM portal_users
GROUP BY active
');
}
protected function fields()
{
return [
Text::create('label'),
Text::create('total')
];
}
}
I'm new to Koolreport and Dashboard and I was intending to debug my rawSQL result to try to understand why the donut chart is all gray, but I can't get paste the logging test at onCreated, since that log line makes the dashboard respond this:
The application encountered an unexpected condition that prevented it from fulfilling your request
I tryend with and without requiring AppLog.php at index.php along side App.log, not sure if necessary, but none worked. Could you please help, pointing me to the right direction?
Thanks.