With the argument $log you can activate to add also a logging entry. So the message will be outputted as well as logged. With $name you can choose the filename of the logging file where to output. The default file is com_joomgallery.log.php. If you add a logging name the file will look like com_joomgallery.name.log.php.
How to test this PR
Scenario 1 (manually set an error)
Edit a HtmlView.php file of your choice. Add the following line:
$this->component->setError('Your error message');
Activate "Debug System" in the Joomla global configuration. Access the view you edited.
You should get the error message as a bootstrap alert box
Additionally you get the message in the Joomla internal debugging console
And you should see a file in your Joomla log directory called com_joomgallery.log.php where you find the error message
Scenario 2 (error during upload)
Upload two faulty images via the uppy uploader.
You should see a file in your Joomla log directory called com_joomgallery.log.php where you find the error message thrown from uploading the faulty images.
Scenario 3 (error during migration)
Force an error during migration in step 3 of the migration manager.
You should see a file in your Joomla log directory called com_joomgallery.log.php where you find the error message thrown from uploading the faulty images.
This PR fixes and improves the error and logging functionities provided by the JoomGallery extension class. The following methods are available:
With the argument
$log
you can activate to add also a logging entry. So the message will be outputted as well as logged. With$name
you can choose the filename of the logging file where to output. The default file iscom_joomgallery.log.php
. If you add a logging name the file will look likecom_joomgallery.name.log.php
.How to test this PR
Scenario 1 (manually set an error)
Edit a HtmlView.php file of your choice. Add the following line:
Activate "Debug System" in the Joomla global configuration. Access the view you edited.
You should get the error message as a bootstrap alert box![grafik](https://github.com/JoomGalleryfriends/JG4-dev/assets/39154009/6557f4cd-1b27-41c9-b55f-2c0624185eba)
Additionally you get the message in the Joomla internal debugging console![grafik](https://github.com/JoomGalleryfriends/JG4-dev/assets/39154009/aece8541-13b7-4bbe-8204-2121f672e2d7)
And you should see a file in your Joomla log directory called![grafik](https://github.com/JoomGalleryfriends/JG4-dev/assets/39154009/1cd9555c-9535-4b1a-916c-eb7af7a20710)
com_joomgallery.log.php
where you find the error messageScenario 2 (error during upload)
Upload two faulty images via the uppy uploader. You should see a file in your Joomla log directory called
com_joomgallery.log.php
where you find the error message thrown from uploading the faulty images.Scenario 3 (error during migration)
Force an error during migration in step 3 of the migration manager. You should see a file in your Joomla log directory called
com_joomgallery.log.php
where you find the error message thrown from uploading the faulty images.