2017 © Pedro Peláez
 

library logging

Cli Menu code for writing CLI applications in PHP 5.3+

image

irap/logging

Cli Menu code for writing CLI applications in PHP 5.3+

  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 9 % Grown

The README.md

Logging Package

This package aims to make it easy to log things., (*1)

UDP Logger

Using UDP for logging is great if you want to be able to fire-and-forget your log messages, improving performance at the penalty of not being able to guarantee log messages are received., (*2)

Here is an example of how to send a log to a server ar 192.168.1.1 on port 1234 using the UdpLogger:, (*3)

<?php
$udpLogger = new \iRAP\Logging\UdpLogger("192.168.1.1", 1234);
$udpLogger->alert("This is my alert message", ['time' => time()]);

For the UDP logger to work, you will have to have a service listening for these logs. Below is an example of a script you could use to create such a service:, (*4)

<?php

# Create a callback for handling the captured UDP log
$logHandler = function($from, $message, $logLevel, $context) {
    print "{$from} ({$logLevel}): {$message}" . PHP_EOL;
    print "context: " . print_r($context, true) . PHP_EOL . PHP_EOL;
    // now do something else like log it to the database.
};

# Createthe UDP reciever which will listen for logs
$udpReciever = new iRAP\Logging\UdpLogReciever(
    $maxLength = 1024*1024*32,
    1234,
    $logHandler
);

# Call the listen() to listen for UDP logs.
print "listening for messages..." . PHP_EOL;
while (true)
{
    $udpReciever->listen();
}

The Versions

23/10 2017

dev-master

9999999-dev http://irap.org/

Cli Menu code for writing CLI applications in PHP 5.3+

  Sources   Download

None

The Requires

 

library core

23/10 2017

1.3.2

1.3.2.0 http://irap.org/

Cli Menu code for writing CLI applications in PHP 5.3+

  Sources   Download

None

The Requires

 

library core

13/04 2017

1.3.1

1.3.1.0 http://irap.org/

Cli Menu code for writing CLI applications in PHP 5.3+

  Sources   Download

None

The Requires

 

library core

07/04 2017

1.3.0

1.3.0.0 http://irap.org/

Cli Menu code for writing CLI applications in PHP 5.3+

  Sources   Download

None

The Requires

 

library core

28/10 2015

1.2.0

1.2.0.0 http://irap.org/

Cli Menu code for writing CLI applications in PHP 5.3+

  Sources   Download

None

The Requires

 

library core

17/08 2015

1.1.0

1.1.0.0 http://irap.org/

Cli Menu code for writing CLI applications in PHP 5.3+

  Sources   Download

None

The Requires

 

library core

13/06 2015

1.0.0

1.0.0.0 http://irap.org/

Cli Menu code for writing CLI applications in PHP 5.3+

  Sources   Download

None

The Requires

 

library core