Created
June 26, 2018 07:42
-
-
Save emir/321c02acd35824c85e6c318923cf2cc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Loggers; | |
use Monolog\Formatter\LineFormatter; | |
class LocalLogger | |
{ | |
public function __invoke($logger) | |
{ | |
foreach ($logger->getHandlers() as $handler) { | |
$handler->setFormatter($this->getLogFormatter()); | |
} | |
} | |
protected function getLogFormatter() | |
{ | |
$format = str_replace( | |
'[%datetime%] ', | |
sprintf('[%%datetime%%] %s ', bin2hex(random_bytes(16)), | |
LineFormatter::SIMPLE_FORMAT | |
); | |
return new LineFormatter($format, null, true, true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
missing
)
:correct syntax:
bin2hex(random_bytes(16)))