Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cLog
  • cLogWriter
  • cLogWriterFile
  • cModuleLog
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: /**
 3:  * This file contains the module log class.
 4:  *
 5:  * @package    Core
 6:  * @subpackage Log
 7:  * @version    SVN Revision $Rev:$
 8:  *
 9:  * @author     Dominik Ziegler
10:  * @copyright  four for business AG <www.4fb.de>
11:  * @license    http://www.contenido.org/license/LIZENZ.txt
12:  * @link       http://www.4fb.de
13:  * @link       http://www.contenido.org
14:  */
15: 
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17: 
18: /**
19:  * This class contains the main functionalities for the module logging in
20:  * CONTENIDO.
21:  * The funcationality is almost the same like normal logging with the exception,
22:  * that log entries contains an additional information about the used module.
23:  *
24:  * Example:
25:  * $writer = cLogWriter::factory("File", array('destination' =>
26:  * 'contenido.log'));
27:  *
28:  * $log = new cModuleLog($writer);
29:  * $log->setModule(1);
30:  * $log->log("Anything you want to log.");
31:  *
32:  * @package    Core
33:  * @subpackage Log
34:  */
35: class cModuleLog extends cLog {
36: 
37:     /**
38:      * @var cApiModule instance of module model
39:      */
40:     private $_module;
41: 
42:     /**
43:      * Constructor of the module log.
44:      *
45:      * @param mixed $writer Writer object (any subclass of cLogWriter), or false
46:      *        if cLog should handle the writer creation
47:      *
48:      */
49:     public function __construct($writer = false) {
50:         parent::__construct($writer);
51: 
52:         $this->setShortcutHandler('module', array(
53:             $this,
54:             'shModule'
55:         ));
56:         $this->getWriter()->setOption("log_format", "[%date] [%level] [%module] %message", true);
57:     }
58: 
59:     /**
60:      * Sets the module to use.
61:      *
62:      * setModule automatically buffers basic module information to the log to
63:      * assist the developer in debugging his modules.
64:      *
65:      * @param int $idmod The module ID to use
66:      * @throws cException if the module with the given idmod could not be loaded
67:      */
68:     public function setModule($idmod) {
69:         $this->_module = new cApiModule($idmod);
70:         if ($this->_module->isLoaded() == false) {
71:             throw new cException('Could not load module information.');
72:         }
73:     }
74: 
75:     /**
76:      * Shortcut Handler Module.
77:      * Returns the ID and the name of the module.
78:      *
79:      * @return string ID and name of the module
80:      */
81:     public function shModule() {
82:         if ($this->_module->isLoaded() == false) {
83:             return '';
84:         }
85: 
86:         return $this->_module->get("idmod") . ": " . $this->_module->get("name");
87:     }
88: }
89: 
90: ?>
CMS CONTENIDO 4.9.1 API documentation generated by ApiGen 2.8.0