<commit_before><?php
/**
 * Generated Header (not documented yet)
 *
 * @author Anakeen 2000 
 * @version $Id: Class.Log.php,v 1.10 2004/04/23 15:35:20 eric Exp $
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @package WHAT
 * @subpackage CORE
 */
 /**
 */

// ---------------------------------------------------------------------------
//    O   Anakeen - 2000
//   O*O  <NAME>, <NAME>
//    O   <EMAIL>, <EMAIL>
// ---------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify 
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or (at
//  your option) any later version.
//
// This program is distributed in the hope that it will be useful, but 
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
// 
// You should have received a copy of the GNU General Public License along 
// with this program; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// ---------------------------------------------------------------------------
// $Id: Class.Log.php,v 1.10 2004/04/23 15:35:20 eric Exp $
// <EMAIL>
// ---------------------------------------------------------------------------

$CLASS_LOG_PHP="";

Class Log {


// ------------------------------------------------------------------------
function Log($logfile="",$application="",$function="") {
  $this->usesyslog = 0;
  if ($logfile == "") {
    $this->usesyslog = 1;
  } else {
    $fd = fopen($logfile,"a");
    if (!$fd) {
      $this->usesyslog = 1;
      $this->error("Can't access $logfile, using syslog");
    } else {
      $this->logfile = $logfile;
      fclose($fd);
    }
  }
  $this->application = $application;
  $this->function = $function;
}

// ------------------------------------------------------------------------
function debug($string, $args=NULL) { $this->wlog("D",$string); }
function callstack($string, $args=NULL) { $this->wlog("C",$string); }
function info($string, $args=NULL) { $this->wlog("I",$string); }
function warning($string, $args=NULL) { $this->wlog("W",$string); }
function error($string, $args=NULL) { $this->wlog("E",$string); }
function fatal($string, $args=NULL) { $this->wlog("F",$string); }

function start() {
   $deb=gettimeofday();
   $this->deb=$deb["sec"]+$deb["usec"]/1000000;
   $this->tic=$this->deb;
}

function tic($text) {
   $tic=gettimeofday();
   $now=$tic["sec"]+$tic["usec"]/1000000;
   $duree=$now-$this->tic;
   $this->info("CHRONO-INT [$text] : $duree");
   $this->tic=$now;
}

function end($text) {
   $fin=gettimeofday();
   $this->fin=$fin["sec"]+$fin["usec"]/1000000;
   $duree=$this->fin-$this->deb;
   $this->info("CHRONO [$text] : $duree");
}

function push($string) {
  global $CORE_LOGLEVEL;
  if (isset($CORE_LOGLEVEL) && is_int(strpos($CORE_LOGLEVEL, "C"))) {
    global $call_ind,$call_stack,$call_pre,$call_reqid;
    if (!isset($call_ind)) $call_ind=0;
    if (!isset($call_pre)) $call_pre="-";
    if (!isset($call_reqid)) $call_reqid=rand(1,100);
    $this->callstack("($call_reqid) $call_pre : entering $string");
    $call_stack[$call_ind]=$string;
    $call_ind +=1;
    $call_pre = $call_pre."-";
  }<commit_msg>add prefix text for debug<commit_after><?php
/**
 * Generated Header (not documented yet)
 *
 * @author Anakeen 2000 
 * @version $Id: Class.Log.php,v 1.11 2004/07/27 09:49:28 eric Exp $
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @package WHAT
 * @subpackage CORE
 */
 /**
 */

// ---------------------------------------------------------------------------
//    O   Anakeen - 2000
//   O*O  <NAME>, <NAME>
//    O   <EMAIL>, <EMAIL>
// ---------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify 
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or (at
//  your option) any later version.
//
// This program is distributed in the hope that it will be useful, but 
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
// 
// You should have received a copy of the GNU General Public License along 
// with this program; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// ---------------------------------------------------------------------------
// $Id: Class.Log.php,v 1.11 2004/07/27 09:49:28 eric Exp $
// <EMAIL>
// ---------------------------------------------------------------------------

$CLASS_LOG_PHP="";

Class Log {


// ------------------------------------------------------------------------
function Log($logfile="",$application="",$function="") {
  $this->usesyslog = 0;
  if ($logfile == "") {
    $this->usesyslog = 1;
  } else {
    $fd = fopen($logfile,"a");
    if (!$fd) {
      $this->usesyslog = 1;
      $this->error("Can't access $logfile, using syslog");
    } else {
      $this->logfile = $logfile;
      fclose($fd);
    }
  }
  $this->application = $application;
  $this->function = $function;
}

// ------------------------------------------------------------------------
function debug($string, $args=NULL) { $this->wlog("D",$string); }
function callstack($string, $args=NULL) { $this->wlog("C",$string); }
function info($string, $args=NULL) { $this->wlog("I",$string); }
function warning($string, $args=NULL) { $this->wlog("W",$string); }
function error($string, $args=NULL) { $this->wlog("E",$string); }
function fatal($string, $args=NULL) { $this->wlog("F",$string); }

function start($text="") {
   $deb=gettimeofday();
   $this->deb=$deb["sec"]+$deb["usec"]/1000000;
   $this->tic=$this->deb;
   $this->ptext=$text; // prefix
}

function tic($text) {
   $tic=gettimeofday();
   $now=$tic["sec"]+$tic["usec"]/1000000;
   $duree=round($now-$this->tic,3);
   $this->info("CHRONO-INT [$this->ptext]/[$text] : $duree");
   $this->tic=$now;
}

function end($text) {
   $fin=gettimeofday();
   $this->fin=$fin["sec"]+$fin["usec"]/1000000;
   $duree=round($this->fin-$this->deb,3);
   $this->info("CHRONO [$this->ptext]/[$text] : $duree");
}

function push($string) {
  global $CORE_LOGLEVEL;
  if (isset($CORE_LOGLEVEL) && is_int(strpos($CORE_LOGLEVEL, "C"))) {
    global $call_ind,$call_stack,$call_pre,$call_reqid;
    if (!isset($call_ind)) $call_ind=0;
    if (!isset($call_pre)) $call_pre="-";
    if (!isset($call_reqid)) $call_reqid=rand(1,100);
    $this->callstack("($call_reqid) $call_pre : entering $string");
    $call_stack[$call_ind]=$string;
    $call_ind +=1;
    $call_pre = $call_pre."-";
  }
{'fraction_non_alphanumeric': 0.29843906630388084, 'fraction_numerical': 0.025204067019905484, 'mean_word_length': 2.2303422756706754, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 64, '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': '2454446', 'n_tokens_mistral': 2352, 'n_tokens_neox': 2178, 'n_words': 528}