Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Remco committed Apr 16, 2019
2 parents 36b65c4 + d91e1c5 commit c6c28f9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Monolog Microsoft Teams
![Package Version](https://img.shields.io/badge/Version-1.0.0-brightgreen.svg)
![Package Version](https://img.shields.io/badge/Version-1.1.0-brightgreen.svg)
[![Packagist Version](https://img.shields.io/packagist/v/rspeekenbrink/monolog-microsoft-teams.svg)](https://packagist.org/packages/rspeekenbrink/monolog-microsoft-teams)

A [Monolog](https://github.com/Seldaek/monolog) handler to send Microsoft Teams messages via the Incoming Webhook.
Expand Down Expand Up @@ -87,8 +87,5 @@ Or add the teams channel to the default `stack` channel in `config/logging.php`:
],
```

# TODO
- Make compatible with Section Fields

# License
monolog-microsoft-teams is available under the MIT license. See the LICENSE file for more info.
26 changes: 26 additions & 0 deletions src/MicrosoftTeamsFormatter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/*
* This file is part of the Monolog Teams Handler package.
*
* (c) Remco Speekenbrink <remco@speekkie.nl>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Rspeekenbrink\MonologMicrosoftTeams;

use Monolog\Logger;
use Monolog\Formatter\LineFormatter;

/**
* Teams Formatter to make text more readable and add some make-up.
*
* @author Remco Speekenbrink <remco@speekkie.nl>
* @see https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference
*/
class MicrosoftTeamsFormatter extends LineFormatter
{
public const SIMPLE_FORMAT = "[%datetime%] %level_name%: %message%\n";
}
5 changes: 2 additions & 3 deletions src/MicrosoftTeamsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

namespace Rspeekenbrink\MonologMicrosoftTeams;

use Monolog\Formatter\FormatterInterface;
use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Handler\Curl;
use Monolog\Formatter\FormatterInterface;
use Monolog\Logger;

/**
Expand Down Expand Up @@ -50,8 +50,7 @@ public function __construct($webhookUrl, $title = null, $level = Logger::CRITICA
$this->webhookUrl = $webhookUrl;

$this->teamsRecord = new MicrosoftTeamsRecord(
$title,
$this->formatter
$title
);
}

Expand Down
5 changes: 4 additions & 1 deletion src/MicrosoftTeamsLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public function __construct($url, $title = null, $level = Logger::DEBUG, $bubble
{
parent::__construct('microsoft-teams-logger');

$this->pushHandler(new MicrosoftTeamsHandler($url, $title, $level, $bubble));
$handler = new MicrosoftTeamsHandler($url, $title, $level, $bubble);
$handler->setFormatter(new MicrosoftTeamsFormatter());

$this->pushHandler($handler);
}
}
2 changes: 1 addition & 1 deletion src/MicrosoftTeamsRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MicrosoftTeamsRecord
* @var string|null
*/
private $context;

/**
* Title of the card
* @var string|null
Expand Down

0 comments on commit c6c28f9

Please sign in to comment.