2020-12-24 17:01:34 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2024-04-12 06:15:41 +02:00
|
|
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-12-24 17:01:34 +01:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2020-12-24 17:01:34 +01:00
|
|
|
*/
|
|
|
|
|
2021-08-08 03:14:31 +02:00
|
|
|
use App\Utils\Ninja;
|
|
|
|
|
2020-12-24 17:01:34 +01:00
|
|
|
/**
|
|
|
|
* Simple helper function that will log into "invoiceninja.log" file
|
|
|
|
* only when extended logging is enabled.
|
|
|
|
*
|
2020-12-25 12:29:42 +01:00
|
|
|
* @param mixed $output
|
|
|
|
* @param array $context
|
|
|
|
*
|
|
|
|
* @return void
|
2020-12-24 17:01:34 +01:00
|
|
|
*/
|
|
|
|
function nlog($output, $context = []): void
|
|
|
|
{
|
2022-06-21 11:57:17 +02:00
|
|
|
if (! config('ninja.expanded_logging')) {
|
2021-01-15 00:50:27 +01:00
|
|
|
return;
|
2022-06-21 11:57:17 +02:00
|
|
|
}
|
2021-01-14 10:31:27 +01:00
|
|
|
|
2022-06-21 11:57:17 +02:00
|
|
|
if (gettype($output) == 'object') {
|
|
|
|
$output = print_r($output, 1);
|
|
|
|
}
|
2021-08-11 00:06:43 +02:00
|
|
|
|
2022-07-05 08:15:46 +02:00
|
|
|
// $trace = debug_backtrace();
|
2024-01-14 05:05:00 +01:00
|
|
|
|
2022-06-21 11:57:17 +02:00
|
|
|
if (Ninja::isHosted()) {
|
|
|
|
try {
|
|
|
|
info($output);
|
|
|
|
} catch (\Exception $e) {
|
2021-08-11 00:06:43 +02:00
|
|
|
}
|
2022-06-21 11:57:17 +02:00
|
|
|
} else {
|
|
|
|
\Illuminate\Support\Facades\Log::channel('invoiceninja')->info($output, $context);
|
|
|
|
}
|
2022-11-01 12:47:41 +01:00
|
|
|
|
|
|
|
$output = null;
|
|
|
|
$context = null;
|
2023-02-16 02:36:09 +01:00
|
|
|
}
|
2024-05-10 14:32:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
function nrlog($output, $context = []): void
|
|
|
|
{
|
|
|
|
if (! config('ninja.expanded_logging')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gettype($output) == 'object') {
|
|
|
|
$output = print_r($output, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// $trace = debug_backtrace();
|
|
|
|
|
|
|
|
if (Ninja::isHosted()) {
|
|
|
|
try {
|
|
|
|
info($output);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
\Illuminate\Support\Facades\Log::channel('invoiceninja-reminders')->info($output, $context);
|
|
|
|
}
|
|
|
|
|
|
|
|
$output = null;
|
|
|
|
$context = null;
|
|
|
|
}
|