2017 © Pedro Peláez
 

library audit-client

Audit client

image

fei/audit-client

Audit client

  • Friday, July 6, 2018
  • by rwellens
  • Repository
  • 9 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 17 Versions
  • 0 % Grown

The README.md

Audit Client

GitHub licensecontinuousphpGitHub issues, (*1)

Installation

Just add the following requirement to your composer.json file:, (*2)

    "fei/audit-client": "^1.2.0"

Configuration

The audit event client needs some options to work properly. The available options that can be passed to the __construct() or setOptions() methods are :, (*3)

Option Description Type Possible Values Default
OPTION_BASEURL This is the server to which send the requests. string Any URL, including protocol but excluding path --
OPTION_FILTER Minimum notification level required for notifications to be actually sent. int Any AuditEvent::LVL_* constant AuditEvent::LVL_ERROR
OPTION_BACKTRACE Should backtrace be added to notifications before they are sent. bool true / false true

Notes: Audit is an alias of Fei\Service\AuditEvent\Client\Audit AuditEvent is an alias of Fei\Service\Audit\Entity\AuditEvent, (*4)

Usage

Initialization

An Audit client should always be initialized by a dependency injection component, since it requires at least one dependency, which is the transport. Moreover, the BASEURL parameter should also depends on environment., (*5)

// sample configuration for production environment
$audit = new Audit(array(
                            Audit::OPTION_BASEURL  => 'http://audit.flash-global.net',
                            Audit::OPTION_FILTER   => AuditEvent::LVL_DEBUG,
                          )
                    );
// inject transport classes
$audit->setTransport(new BasicTransport());

// optionnal asynchronous transport, that will be automatically used to push notifications
//
// NOTE this transport requires a beanstalk queue able to listen to its requests
$pheanstalk = new Pheanstalk('localhost');
$asyncTransport = new BeanstalkProxyTransport;
$asyncTransport->setPheanstalk($pheanstalk);
$audit->setAsyncTransport($asyncTransport);

Pushing a simple notification

Once you have set up the Audit, you can start pushing notifications by calling the notify() method on the Audit:, (*6)


$audit = $container->get('audit.client'); $audit->notify('AuditEvent message'); // default level is AuditEvent::LVL_INFO $audit->notify('Debug message', array('level' => AuditEvent::LVL_DEBUG));

While its possible to pass more than just the level using the second (array) parameter, it is recommended not to do so. If you want to pass more informations, like a context, please take a look at the following section., (*7)

Pushing a AuditEvent instance

The more reliable way to push a notification is to instantiate it by yourself, and then send it through notify(), that will also accept AuditEvent instances:, (*8)


$audit = $container->get('audit.client'); $auditEvent = new AuditEvent(array('message' => 'AuditEvent message')); $auditEvent ->setLevel(AuditEvent::LVL_WARNING) ->setContext(array('key' => 'value') ; $audit->notify($auditEvent);

The Versions

06/07 2018
06/07 2018
06/07 2018
05/07 2018

dev-feature/lav_add_audit_enabled

dev-feature/lav_add_audit_enabled

Audit client

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

16/03 2018
10/01 2018

dev-feature/update_composer_api_client

dev-feature/update_composer_api_client

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer

13/11 2017

dev-feature/3612_change_limit_function

dev-feature/3612_change_limit_function

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer

13/11 2017

v1.1.3

1.1.3.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer

13/11 2017

v2.0.3

2.0.3.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer

09/11 2017

v2.0.2

2.0.2.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer

10/10 2017

v2.0.1

2.0.1.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer

09/10 2017

v2.0.0

2.0.0.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer

03/10 2017

v1.x-dev

1.9999999.9999999.9999999-dev

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer

03/10 2017

v1.1.2

1.1.2.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer

09/08 2017

v1.1.1

1.1.1.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer

09/08 2017

v1.1.0

1.1.0.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer

14/12 2016

v1.0.0

1.0.0.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Jerome Schaeffer