PHP code example of inquid / yii2-google-debugger

1. Go to this page and download the library: Download inquid/yii2-google-debugger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

inquid / yii2-google-debugger example snippets


        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                'googleCloud' => [
                    'class' => 'inquid\google_debugger\GoogleCloudLogger',
                    'categories' => ['cat1','cat2'], //Your categories to log
                    'levels' => ['info', 'trace', 'warning', 'error'],
                    'except' => ['yii\web\HttpException:*', 'yii\i18n\I18N\*'],
                    'prefix' => function () {
                        $url = !Yii::$app->request->isConsoleRequest ? Yii::$app->request->getUrl() : null;
                        return sprintf('[%s][%s]', Yii::$app->id, $url);
                    },
                    'projectId' => 'project-id',
                    'loggerInstance' => 'instance-log',
                    'clientSecretPath' => '../google_credentials.json' //path to your service account credentials
                ]
            ],
        ],

Yii::debug('start calculating average revenue',GoogleCloudLogger::CATEGORY);
Yii::warning('Warning');
Yii::info('Info');
Yii::error('Error');

php composer.phar