Pipe hosted logs to gelf instead of text files

This commit is contained in:
David Bomba 2021-08-08 11:14:31 +10:00
parent 3a9ca8e6e1
commit 6af9f40f9e

View File

@ -1,5 +1,4 @@
<?php <?php
/** /**
* Invoice Ninja (https://invoiceninja.com). * Invoice Ninja (https://invoiceninja.com).
* *
@ -10,6 +9,8 @@
* @license https://www.elastic.co/licensing/elastic-license * @license https://www.elastic.co/licensing/elastic-license
*/ */
use App\Utils\Ninja;
/** /**
* Simple helper function that will log into "invoiceninja.log" file * Simple helper function that will log into "invoiceninja.log" file
* only when extended logging is enabled. * only when extended logging is enabled.
@ -32,7 +33,10 @@ function nlog($output, $context = []): void
$trace = debug_backtrace(); $trace = debug_backtrace();
//nlog( debug_backtrace()[1]['function']); //nlog( debug_backtrace()[1]['function']);
// \Illuminate\Support\Facades\Log::channel('invoiceninja')->info(print_r($trace[1]['class'],1), []); // \Illuminate\Support\Facades\Log::channel('invoiceninja')->info(print_r($trace[1]['class'],1), []);
\Illuminate\Support\Facades\Log::channel('invoiceninja')->info($output, $context); if(Ninja::isHosted())
info($output);
else
\Illuminate\Support\Facades\Log::channel('invoiceninja')->info($output, $context);
} }