Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Latest commit

 

History

History
44 lines (31 loc) · 1.2 KB

Logging.md

File metadata and controls

44 lines (31 loc) · 1.2 KB

Logging

This library allows you to connect a PSR3 implementation to log an monitor how it's work.

All classes of the mediapart/selligent library that could log messages implements Psr\Log\LoggerAwareInterface.

Logging example with Monolog

For example, if you want to use Monolog :

<?php # monolog-example.php

require './vendor/autoload.php';

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

use Mediapart\Selligent\Configuration;
use Mediapart\Selligent\Connection;
use Mediapart\Selligent\Transport;
use Mediapart\Selligent\Properties;

$logger = new Logger('selligent');
$logger->pushHandler(new StreamHandler('monolog-example.log'));

$connection = new Connection();
$connection->setLogger($logger);
$client = $connection->open([
    'login' => '*****',
    'password' => '*****',
    'wsdl' => 'http://emsecure/individual?wsdl', 
]);

$transport = new Transport($client);
$transport->setLogger($logger);
$transport->setList('TESTLIST');

$user = new Properties();
$user['NAME'] = 'foo bar';
$user['MAIL'] = '[email protected]';
$transport->subscribe($user);