1. Go to this page and download the library: Download waffle-commons/log 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/ */
waffle-commons / log example snippets
use Waffle\Commons\Log\StreamLogger;
use Waffle\Commons\Log\Channel\LogChannel;
$logger = new StreamLogger(
streamPath: 'php://stderr',
channel: LogChannel::HTTP,
permissions: 0o644,
);
$logger->info('Request handled', ['route' => '/users', 'status' => 200]);
public function __construct(
private(set) readonly string $streamPath = 'php://stderr',
private(set) readonly string $channel = LogChannel::APP,
private(set) readonly int $permissions = 0o644,
) { /* opens the stream, chmods if it's a regular file */ }
final class LogChannel
{
public const string APP = 'app';
public const string CORE = 'core';
public const string HTTP = 'http';
public const string SECURITY = 'sec';
public const string AUDIT = 'audit';
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.