PHP code example of bbrist / laravel-console-logger

1. Go to this page and download the library: Download bbrist/laravel-console-logger 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/ */

    

bbrist / laravel-console-logger example snippets


public function mymethod() {

    Log::logToFile(true);   // enable force log-to-file
    
    ... 
    
    Log::info("some message");  // This will always be logged to file (dependent on the LOG_LEVEL ENV value)
    
    ... 
    
    Log::logToFile(false);  // disable force log-to-file

}