08 2024
This commit is contained in:
parent
04d677d37a
commit
bfa3bb1df4
1191 changed files with 637397 additions and 10619 deletions
34
app/Services/MyLog.php
Normal file
34
app/Services/MyLog.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use App\Mail\MailLog;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
|
||||
class MyLog
|
||||
{
|
||||
|
||||
|
||||
|
||||
public static function writeLog($channel = 'payment', $context = 'error', $message = '', $data = []){
|
||||
|
||||
switch ($context) {
|
||||
case 'notice':
|
||||
\Log::channel($channel)->notice($message.' : '.json_encode($data));
|
||||
break;
|
||||
case 'warning':
|
||||
\Log::channel($channel)->warning($message.' : '.json_encode($data));
|
||||
break;
|
||||
case 'info':
|
||||
\Log::channel($channel)->info($message.' : '.json_encode($data));
|
||||
break;
|
||||
default:
|
||||
\Log::channel($channel)->error($message.' : '.json_encode($data));
|
||||
break;
|
||||
}
|
||||
Mail::to(config('app.exception_mail'))->send(new MailLog($channel, $context, $message, $data));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue