mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-24 18:16:10 +02:00
Added support for Loggly batch uploads
This commit is contained in:
36
src/Monolog/Formatter/LogglyFormatter.php
Normal file
36
src/Monolog/Formatter/LogglyFormatter.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Monolog package.
|
||||
*
|
||||
* (c) Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Monolog\Formatter;
|
||||
|
||||
/**
|
||||
* Extends the standard JsonFormatter to format messages compatible with Loggly.
|
||||
*
|
||||
* @author Adam Pancutt <adam@pancutt.com>
|
||||
*/
|
||||
class LogglyFormatter extends JsonFormatter
|
||||
{
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function formatBatch(array $records)
|
||||
{
|
||||
$instance = $this;
|
||||
|
||||
array_walk($records, function(&$value, $key) use ($instance) {
|
||||
$value = $instance->format($value);
|
||||
});
|
||||
|
||||
return implode("\n", $records);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user