<commit_before>PHP Supervisor Event Framework
==============================

Receives event notifications from Supervisor and sends the parsed notification
to a callback function.

Requirements
============

PHP 5.3
Supervisord

Running the example
===================

Open your supervisord.conf file and add the following:

    [eventlistener:event_listener]
    command=php /path/to/examples/log.php
    process_name=%(program_name)s_%(process_num)02d
    numprocs=1
    events=PROCESS_STATE_STARTING,TICK_5
    autostart=true
    autorestart=unexpected
    stderr_logfile_backups=3

Replace /path/to with the correct path.  More event listener options can be
found at http://supervisord.org/events.html

Now run:

    supervisorctl reload

Example event script
--------------------

    <?php

    // include the phar file
    require_once '/path/to/build/php-supervisor-event.phar';

    use Supervisor\EventListener;
    use Supervisor\EventNotification;

    $listener = new Supervisor\EventListener();
    $listener->listen(function(EventListener $listener, EventNotification $event) {
        $listener->log($event->getEventName());
        $listener->log($event->getServer());
        $listener->log($event->getPool());
        // Try messing around with supervisorctl to restart processes and see what
        // data is available
        $listener->log(var_export($event->getData(), true));
        return true;
    });<commit_msg>Updating README<commit_after>PHP Supervisor Event Framework
==============================

Receives event notifications from Supervisor and sends the parsed notification
to a callback function.

Requirements
============

* PHP 5.3
* Supervisord

Example event script
--------------------

    <?php

    // include the phar file
    require_once '/path/to/build/php-supervisor-event.phar';

    use Supervisor\EventListener;
    use Supervisor\EventNotification;

    $listener = new Supervisor\EventListener();
    $listener->listen(function(EventListener $listener, EventNotification $event) {
        $listener->log($event->getEventName());
        $listener->log($event->getServer());
        $listener->log($event->getPool());
        // Try messing around with supervisorctl to restart processes and see what
        // data is available
        $listener->log(var_export($event->getData(), true));
        return true;
    });

Running the example
===================

Open your supervisord.conf file and add the following:

    [eventlistener:event_listener]
    command=php /path/to/examples/log.php
    process_name=%(program_name)s_%(process_num)02d
    numprocs=1
    events=PROCESS_STATE_STARTING,TICK_5
    autostart=true
    autorestart=unexpected
    stderr_logfile_backups=3

Replace /path/to with the correct path.  More event listener options can be
found at http://supervisord.org/events.html

Now run:

    supervisorctl reload
{'fraction_non_alphanumeric': 0.14512785072563925, 'fraction_numerical': 0.0048375950241879755, 'mean_word_length': 3.609872611464968, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3153620', 'n_tokens_mistral': 810, 'n_tokens_neox': 775, 'n_words': 207}