<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$
 */

  uses('util.log.LogAppender');

  /**
   * LogAppender which appends data to syslog
   *
   * @see      xp://util.log.LogAppender
   * @see      php://syslog
   * @purpose  Appender
   */  
  class SyslogAppender extends LogAppender {

    /**
     * Destructor.
     *
     */
    public function __destruct() {
      $this->finalize();
    }
        
    /**
     * Constructor
     *
     * @param   string identifier default NULL if omitted, defaults to script's filename
     * @param   int facility default LOG_USER
     * @see     php://openlog for valid facility values
     */
    public function __construct($identifier= NULL, $facility= LOG_USER) {
      openlog(
        $identifier ? $identifier : basename($_SERVER['PHP_SELF']), 
        LOG_ODELAY | LOG_PID, 
        $facility
      );
    }
    
    /**
     * Appends log data to the syslog
     *
     * @param   mixed args variables
     */
    public function append() {
      $buf= '';
      foreach (func_get_args() as $arg) {
        $buf.= $this->varSource($arg).' ';
      }
      syslog($buf);
    }
    
    /**
     * Finalize this appender - is called when the logger shuts down
     * at the end of the request.
     *<commit_msg>- Fix "syslog() expects exactly 2 parameters, 1 given" # Funny, this can never have worked but was in SVN like this since Dec. 2006<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$
 */

  uses('util.log.LogAppender');

  /**
   * LogAppender which appends data to syslog
   *
   * @see      xp://util.log.LogAppender
   * @see      php://syslog
   * @purpose  Appender
   */  
  class SyslogAppender extends LogAppender {

    /**
     * Destructor.
     *
     */
    public function __destruct() {
      $this->finalize();
    }
        
    /**
     * Constructor
     *
     * @param   string identifier default NULL if omitted, defaults to script's filename
     * @param   int facility default LOG_USER
     * @see     php://openlog for valid facility values
     */
    public function __construct($identifier= NULL, $facility= LOG_USER) {
      openlog(
        $identifier ? $identifier : basename($_SERVER['PHP_SELF']), 
        LOG_ODELAY | LOG_PID, 
        $facility
      );
    }
    
    /**
     * Appends log data to the syslog
     *
     * @param   mixed args variables
     */
    public function append() {
      $buf= '';
      foreach (func_get_args() as $arg) {
        $buf.= $this->varSource($arg).' ';
      }
      syslog(LOG_INFO, $buf);
    }
    
    /**
     * Finalize this appender - is called when the logger shuts down
     * at the end of the request.
     *
{'fraction_non_alphanumeric': 0.11808118081180811, 'fraction_numerical': 0.002214022140221402, 'mean_word_length': 1.940347071583514, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4658147', 'n_tokens_mistral': 863, 'n_tokens_neox': 825, 'n_words': 234}