Dokumentation: Task-Manager für mehrere Mandanten
[kivitendo-erp.git] / shopxtc / error.php
1 <?php
2
3 class error {
4
5   var $log = false; 
6   var $api = '';
7   var $lf  = '<br />';
8
9   function error($api) {
10      $this->log = fopen("/tmp/shop.log","a");
11      $this->api = $api;
12      if ( $api == 'cli' ) { $this->lf = "\n"; }
13      else { $this->lf = "<br />"; };
14   }
15
16   function write($func,$string) {
17      $now = date('Y-m-d H:m:i ');
18      fputs($this->log,$now.$func."\n");
19      fputs($this->log,$string."\n");
20   }
21
22   function close() {
23      fclose($this->log);
24   }
25   function out($txt,$lf=false) {
26     if ( $this->api != 'cli' ) {
27         echo str_repeat(" ", 256);
28         echo $txt;
29         if ( $lf ) echo $this->lf;
30         flush(); ob_flush();
31     } else {
32         echo $txt;
33         if ( $lf ) echo $this->lf;
34     }
35   }
36 }
37 ?>