From 67c1be209dcf7bcee2e40fce98dd649aa1140b51 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 8 Sep 2023 21:11:53 +1000 Subject: [PATCH] Logging changes when processing TIC files --- app/Classes/FTN/Tic.php | 6 +++--- app/Jobs/TicProcess.php | 2 +- app/Models/Echomail.php | 6 +++--- app/Models/File.php | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/Classes/FTN/Tic.php b/app/Classes/FTN/Tic.php index 896bab5..feea9b0 100644 --- a/app/Classes/FTN/Tic.php +++ b/app/Classes/FTN/Tic.php @@ -144,7 +144,7 @@ class Tic extends FTNBase */ public function load(string $filename): void { - Log::info(sprintf('%s:Processing TIC file [%s]',self::LOGKEY,$filename)); + Log::info(sprintf('%s:+ Processing TIC file [%s]',self::LOGKEY,$filename)); if (str_contains($filename,'-')) { list($hex,$name) = explode('-',$filename); @@ -154,10 +154,10 @@ class Tic extends FTNBase } if (! file_exists($filename)) - throw new FileNotFoundException(sprintf('%s:File [%s] doesnt exist',self::LOGKEY,$filename)); + throw new FileNotFoundException(sprintf('File [%s] doesnt exist',$filename)); if (! is_readable($filename)) - throw new UnableToWriteFile(sprintf('%s:File [%s] is not readable',self::LOGKEY,realpath($filename))); + throw new UnableToWriteFile(sprintf('File [%s] is not readable',realpath($filename))); $f = fopen($filename,'rb'); if (! $f) { diff --git a/app/Jobs/TicProcess.php b/app/Jobs/TicProcess.php index 47fdff5..3fdcc5f 100644 --- a/app/Jobs/TicProcess.php +++ b/app/Jobs/TicProcess.php @@ -59,7 +59,7 @@ class TicProcess implements ShouldQueue $to = new Tic; $to->load(storage_path('app').'/'.$this->file); - Log::info(sprintf('%s:Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->name,$to->fo->id)); + Log::info(sprintf('%s:= Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->name,$to->fo->id)); unlink(storage_path('app').'/'.$this->file); diff --git a/app/Models/Echomail.php b/app/Models/Echomail.php index cbdd81b..43a2b55 100644 --- a/app/Models/Echomail.php +++ b/app/Models/Echomail.php @@ -109,11 +109,11 @@ final class Echomail extends Model implements Packet if ($exportto->count()) { if ($model->no_export) { - Log::debug(sprintf('%s:- NOT processing exporting of message by configuration [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(','))); + Log::alert(sprintf('%s:- NOT processing exporting of message by configuration [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(','))); return; } - Log::debug(sprintf('%s:- Exporting message [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(','))); + Log::info(sprintf('%s:- Exporting message [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(','))); // Save the seenby for the exported systems $model->seenby()->syncWithPivotValues($exportto,['export_at'=>Carbon::now()],FALSE); @@ -165,7 +165,7 @@ final class Echomail extends Model implements Packet */ public function packet(Address $ao): Message { - Log::debug(sprintf('%s:+ Bundling [%s]',self::LOGKEY,$this->id)); + Log::info(sprintf('%s:+ Bundling [%s]',self::LOGKEY,$this->id)); // @todo Dont bundle mail to nodes that have been disabled, or addresses that have been deleted $o = new Message; diff --git a/app/Models/File.php b/app/Models/File.php index 6c782c3..8d78b0f 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -56,7 +56,7 @@ class File extends Model parent::boot(); static::creating(function($model) { - Log::debug(sprintf('%s:- Storing file [%s] in [%s]',self::LOGKEY,$model->fullname,$model->full_storage_path)); + Log::info(sprintf('%s:- Storing file [%s] in [%s]',self::LOGKEY,$model->fullname,$model->full_storage_path)); // Store file if (Storage::put($model->full_storage_path,Storage::disk('local')->get($model->fullname),'public')) { @@ -122,11 +122,11 @@ class File extends Model if ($exportto->count()) { if ($model->no_export) { - Log::debug(sprintf('%s:- NOT processing exporting of message by configuration [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(','))); + Log::alert(sprintf('%s:- NOT processing exporting of message by configuration [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(','))); return; } - Log::debug(sprintf('%s:- Exporting file [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(','))); + Log::info(sprintf('%s:- Exporting file [%s] to [%s]',self::LOGKEY,$model->id,$exportto->join(','))); // Save the seenby for the exported systems $model->seenby()->syncWithPivotValues($exportto,['export_at'=>Carbon::now()],FALSE);