PHP code example of putyourlightson / craft-log-to-file

1. Go to this page and download the library: Download putyourlightson/craft-log-to-file library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

putyourlightson / craft-log-to-file example snippets


use putyourlightson\logtofile\LogToFile;

$message = 'The message to log.';

// Log as info
LogToFile::info($message, 'my-plugin-handle');

// Log as error
LogToFile::error($message, 'my-plugin-handle');

// Log as Yii message level
LogToFile::log($message, 'my-plugin-handle', 'error');

// Log as custom category
LogToFile::log($message, 'my-plugin-handle', 'custom-category');