PHP code example of egeniq / monolog-gdpr

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

    

egeniq / monolog-gdpr example snippets




use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Egeniq\Monolog\Gdpr\Processor\RedactEmailProcessor;

$log = new Logger('name');
$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));

$processor = new RedactEmailProcessor();
// optionally you may configure a salt:
$processor->setSalt('h@tsefl@ts!');
$log->pushProcessor($processor);

$log->log(Logger::DEBUG, 'This is a test for [email protected]', ['foo' => ['bar' => '[email protected]']]);



use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Egeniq\Monolog\Gdpr\Processor\RedactIpProcessor;

$log = new Logger('name');
$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));

$processor = new RedactIpProcessor();

// optionally you may configure a salt:
$processor->setSalt('h@tsefl@ts!');
$log->pushProcessor($processor);

$log->log(Logger::DEBUG, 'This is a test for 127.0.0.1', ['foo' => ['bar' => '127.0.0.1']]);