Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
rvrieling committed Jul 14, 2020
1 parent 38fab3d commit 9617e70
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
46 changes: 46 additions & 0 deletions src/GoogleChatFormatter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace VrielingSoftwareOntwikkeling\LaravelGoogleChat;


use Monolog\Formatter\NormalizerFormatter;

class GoogleChatFormatter extends NormalizerFormatter
{
const LOG = 'log';
const STORE = 'store';
const CHANGE = 'change';
const DELETE = 'delete';
/**
* result
*/
const SUCCESS = 'success';
const NEUTRAL = 'neutral';
const FAILURE = 'failure';

public function __construct()
{
parent::__construct();
}

public function format(array $record)
{
$record = parent::format($record);

return $this->getDocument($record);
}

/**
* Convert a log message into an MariaDB Log entity
* @param array $record
* @return array
*/
protected function getDocument(array $record)
{
$fills = $record['extra'];
$fills['level'] = str()->lower($record['level_name']);
$fills['description'] = $record['message'];

return $fills;
}
}
2 changes: 1 addition & 1 deletion src/GoogleChatHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ protected function write(array $record): void
*/
protected function getDefaultFormatter()
{
return;
return new GoogleChatFormatter();
}
}

0 comments on commit 9617e70

Please sign in to comment.