PHP code example of solophp / logger

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

    

solophp / logger example snippets


use Solo\Logger;

// Initialize logger
$logger = new Logger('/path/to/log/file.log');

// Log messages
$logger->info('Application started');
$logger->error('An error occurred', ['error_code' => 500]);

$logger = new Logger('/path/to/log/file.log', 'America/New_York');

$logger->setLogFile('/path/to/another/file.log');
$logger->setTimezone('Asia/Tokyo');