Changeset 297 in t29-www for lib/logging.php


Ignore:
Timestamp:
Sep 15, 2012, 7:32:28 PM (12 years ago)
Author:
sven
Message:

Verschiedenste Arbeiten im Backend:

  • URL-Catching-System implementiert, per Env-Variable und Mod-Rewrite. Alle Dateien sollen jetzt auch ohne .php-Endung laden bzw. auf eben jene URL-Repräsentation weiterleiten.
  • 404er-System mit Redirect-Mapping implementiert, die alte Geräteseiten auf neue Pendants weiterleitet.

Außerdem in dem Zug das Hostsystem und Loggingsystem umgebastelt. Caching-Fehler müssen noch frühzeitig erkannt werden, um nervige "Cache kann nicht geschrieben werden"-Fehler nicht mehr am Ende der Seite zu haben, sondern an präsenter Stelle oben.

Das Hostsystem kann nun per SERVER_NAME die Hostinstanz wählen, sodass das Seitenbearbeiten auf Heriberts Computer auf diese Weise funktionieren sollte.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/logging.php

    r275 r297  
    11<?php
     2/**
     3 * t29Log is a very lightweight logging system for t29v6.
     4 *
     5 * The logging class is accessible via the Singleton pattern, but should
     6 * be stored in a $GLOBAL["log"] and accessible like that everywhere.
     7 * The contents are printed in t29Template.
     8 *
     9 * Inspired by Klooger for PHP: https://github.com/katzgrau/KLogger/
     10 **/
    211
    3 /**
    4         Inspired by Klooger,
    5         https://github.com/katzgrau/KLogger/
    6 */
     12
    713class t29Log {
    814        const EMERG  = 'emerg';  // Emergency: system is unusable
     
    3238        public $entries = array();
    3339       
    34         function __construct() {
     40        // the one global t29Log instance
     41        private static $instance;
     42       
     43        // singleton access method
     44        public function get() {
     45                if(!isset(self::$instance))
     46                        self::$instance = new t29Log;
     47                return self::$instance;
     48        }
     49       
     50        private function __construct() {
    3551                // we shall be the PHP error handler
    3652                set_error_handler(array($this, 'log_phperror'));
     
    86102        }
    87103
    88        
     104        public function INFO($line, $args = self::NO_ARGUMENTS){
     105                $this->log($line, self::INFO, $args);
     106        }
     107
     108        public function DEBUG($line, $args = self::NO_ARGUMENTS){
     109                $this->log($line, self::INFO, $args);
     110        }
    89111       
    90112} // class
Note: See TracChangeset for help on using the changeset viewer.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License