Log into a specific file

  • Hello folks,


    this will show you how to log into a different file than the usual files.

    This can be very useful if you want to keep the logs for a given process (e.G.: a Webhook) separated.


    The basic logging is done with the \QUI\System\Log class, as you may know already.

    Its functions allow you to provide a filename, which should be used to log into.


    PHP: example.log.php
    1. // This will log into the default log file.
    2. \QUI\System\Log::writeRecursive("Webhook is executing");
    3. // This will write the log entry into the specified file. In this case: webhook.log
    4. \QUI\System\Log::writeRecursive("Webhook is executing",\QUI\System\Log::LEVEL_INFO,[],"webhook");


    This should allow you to keep your log directory clean and get all the info you need.


    Happy coding!