1: <?php
2:
3: /**
4: * This file contains the module log class.
5: *
6: * @package Core
7: * @subpackage Log
8: * @version SVN Revision $Rev:$
9: *
10: * @author Dominik Ziegler
11: * @copyright four for business AG <www.4fb.de>
12: * @license http://www.contenido.org/license/LIZENZ.txt
13: * @link http://www.4fb.de
14: * @link http://www.contenido.org
15: */
16:
17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
18:
19: /**
20: *
21: * This class contains the main functionalities for the module logging in
22: * CONTENIDO.
23: * The funcationality is almost the same like normal logging with the exception,
24: * that log entries contains an additional information about the used module.
25: *
26: * Example:
27: * $writer = cLogWriter::factory("File", array('destination' =>
28: * 'contenido.log'));
29: *
30: * $log = new cModuleLog($writer);
31: * $log->setModule(1);
32: * $log->log("Anything you want to log.");
33: *
34: * @package Core
35: * @subpackage Log
36: * @deprecated [2015-05-21]
37: * This class is no longer supported
38: */
39: class cModuleLog extends cLog {
40:
41: /**
42: * @var cApiModule
43: * instance of module model
44: */
45: private $_module;
46:
47: /**
48: * Constructor of the module log.
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 log to
73: * 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: