1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4573 from beganovich/v5-nlog

(v5) nlog()
This commit is contained in:
Benjamin Beganović 2020-12-24 17:03:14 +01:00 committed by GitHub
commit b879f7a2d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 0 deletions

View File

@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*

31
app/Helpers/Generic.php Normal file
View File

@ -0,0 +1,31 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
/**
* Simple helper function that will log into "invoiceninja.log" file
* only when extended logging is enabled.
*
* @param mixed $output
* @param array $context
*
* @return void
*/
function nlog($output, $context = []): void
{
if (config('ninja.expanded_logging')) {
if (gettype($output) == 'object') {
$output = print_r($output, 1);
}
\Illuminate\Support\Facades\Log::channel('invoiceninja')->info($output, $context);
}
}

View File

@ -99,6 +99,11 @@ return [
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
'invoiceninja' => [
'driver' => 'single',
'path' => storage_path('logs/invoiceninja.log'),
],
],
];

View File

@ -136,4 +136,5 @@ return [
'base_path' => resource_path('views/pdf-designs/'),
],
'log_pdf_html' => env('LOG_PDF_HTML', false),
'expanded_logging' => env('EXPANDED_LOGGING', false),
];