Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Todor Mitovski
committed
Jul 27, 2018
1 parent
251dfe9
commit 88d55dd
Showing
5 changed files
with
203 additions
and
62 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace App\Extensions\Monolog\Handler; | ||
|
||
use Monolog\Formatter\GelfMessageFormatter; | ||
use Monolog\Handler\AbstractProcessingHandler; | ||
use Monolog\Logger; | ||
|
||
class FluentdHandler extends AbstractProcessingHandler | ||
{ | ||
protected $config; | ||
|
||
public function __construct($level = Logger::DEBUG, $bubble = true) | ||
{ | ||
parent::__construct($level, $bubble); | ||
|
||
$this->logger = new \Fluent\Logger\FluentLogger(config('logger.host'), config('logger.port')); | ||
} | ||
|
||
protected function getDefaultFormatter() | ||
{ | ||
return new GelfMessageFormatter; | ||
} | ||
|
||
public function write(array $record) | ||
{ | ||
$this->logger->post(config('logger.tag.'. config('app.env')), $record['formatted']->toArray()); | ||
} | ||
} |
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
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
Oops, something went wrong.