<commit_before>= Simplogger: Simple PHP logging utility

== Overview

The goal of Simplogger is to provide a logging utility for PHP that is
lightweight, simple to use, and simple to integrate.

Simplogger can log to stdout/stderr, to local syslogd (via /dev/log,
using PHP's built-in syslog functions) or to remote syslogd (via UDP).

Typical use case is a PHP microservice that logs to syslog when
deployed, but can just as easily use stdout/stderr (e.g. in the
development environment).

  require('Simplogger.php');
  $ident = basename($argv[0]);
  $opts = getopt('s', ['syslog']);
  $logger = array_key_exists('s', $opts) || array_key_exists('syslog', $opts)
    ? new \Simplogger\SyslogLogger($ident, LOG_CONS, LOG_LOCAL1) 
    : new \Simplogger\StdoutLogger;
  $logger->notice('Hello world!');

== Setup

Copy `Simplogger.php` to a directory of your choice and import it.

  require('Simplogger.php');

=== Log to local syslog

  $ident = 'my-program-name';
  $logger = new \Simplogger\SyslogLogger($ident, LOG_CONS, LOG_LOCAL1);

`SyslogLogger` logs using PHP's `http://php.net/manual/en/function.syslog.php[syslog()]`
function, and parameters are the same as passed to
`http://php.net/manual/en/function.openlog.php[openlog()]`.

=== Log to remote syslogd via UDP

  $syslogHost = 10.11.12.13;
  $logger = new \Simplogger\RemoteSysLogger($ident, LOG_LOCAL1, $syslogHost, 514);

`RemoteSysLogger` sends all messages to syslogd over UDP.
Default host is `127.0.0.1`, default port is `514`.

=== Log to stdout/stderr

  $logger = new \Simplogger\StdoutLogger;

`StdoutLogger` writes all messages to stdout.

`StderrLogger` writes all messages to stderr.

`StdouterrLogger` writes WARNING and higher severity messages to stderr,
writes other messages to stdout.<commit_msg>README: use example IP address (RFC 5737)<commit_after>= Simplogger: Simple PHP logging utility

== Overview

The goal of Simplogger is to provide a logging utility for PHP that is
lightweight, simple to use, and simple to integrate.

Simplogger can log to stdout/stderr, to local syslogd (via /dev/log,
using PHP's built-in syslog functions) or to remote syslogd (via UDP).

Typical use case is a PHP microservice that logs to syslog when
deployed, but can just as easily use stdout/stderr (e.g. in the
development environment).

  require('Simplogger.php');
  $ident = basename($argv[0]);
  $opts = getopt('s', ['syslog']);
  $logger = array_key_exists('s', $opts) || array_key_exists('syslog', $opts)
    ? new \Simplogger\SyslogLogger($ident, LOG_CONS, LOG_LOCAL1) 
    : new \Simplogger\StdoutLogger;
  $logger->notice('Hello world!');

== Setup

Copy `Simplogger.php` to a directory of your choice and import it.

  require('Simplogger.php');

=== Log to local syslog

  $ident = 'my-program-name';
  $logger = new \Simplogger\SyslogLogger($ident, LOG_CONS, LOG_LOCAL1);

`SyslogLogger` logs using PHP's `http://php.net/manual/en/function.syslog.php[syslog()]`
function, and parameters are the same as passed to
`http://php.net/manual/en/function.openlog.php[openlog()]`.

=== Log to remote syslogd via UDP

  $syslogHost = 192.0.2.22;
  $logger = new \Simplogger\RemoteSysLogger($ident, LOG_LOCAL1, $syslogHost, 514);

`RemoteSysLogger` sends all messages to syslogd over UDP.
Default host is `127.0.0.1`, default port number is 514.

=== Log to stdout/stderr

  $logger = new \Simplogger\StdoutLogger;

`StdoutLogger` writes all messages to stdout.

`StderrLogger` writes all messages to stderr.

`StdouterrLogger` writes WARNING and higher severity messages to stderr,
writes other messages to stdout.
{'fraction_non_alphanumeric': 0.11789297658862877, 'fraction_numerical': 0.014214046822742474, 'mean_word_length': 4.6078125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '1586393', 'n_tokens_mistral': 1237, 'n_tokens_neox': 1180, 'n_words': 396}