PHP

Create a log

Be sure to check out the Get Started section for information on how to register for an account and create your first log. While creating your log choose “PHP” option in “Language and framework” select field.

Install Muscula appender

Install Muscula PHP Logger by running this command from your application directory:

composer require muscula/muscula-php-logger

Initialize Muscula

Install Muscula PHP Logger by running this command from your application directory:

$handler = Muscula\Handler::getInstance(); $handler->start(LOG_ID);

Copy the code using the copy tool in the top right corner of the code box and paste it in index.php of your Application.

Remember to replace "LOG_ID" with your current LOG ID. If you place code directly from Muscula Application LOG ID will be filled. Click here to see instructions on how to find your LOG ID in Mucula App.

From this moment all your errors will be visible in Muscula system.
At https://packagist.org/packages/muscula/muscula-php-logger you can find full documentation.

If you can’t find what you're looking for, contact us and we will update the documentation. Thanks, and enjoy Muscula!


Structural logging

You can pass any data alongside your log message. On example below we are sending additional data alongside error.

$handler = Muscula\Handler::getInstance(); $handler->start(LOG_ID); $someObj = (object)[ 'Application' => 'ConsoleManager', 'ProductIntegrationRequestId' => 2049382, 'AsyncTask' => 'ExportTaskExecutor']; $handler->debug("Request information", $someObj);

After this you will see in error details all data sent:

muscula-app-structural-logging