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