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: *
53: * @param mixed $writer [optional]
54: * Writer object (any subclass of cLogWriter),
55: * or false if cLog should handle the writer creation
56: *
57: * @throws cInvalidArgumentException
58: */
59: public function __construct($writer = false) {
60: cDeprecated("The cModuleLog classes are no longer supported.");
61:
62: parent::__construct($writer);
63:
64: $this->setShortcutHandler('module', array(
65: $this,
66: 'shModule'
67: ));
68: $this->getWriter()->setOption("log_format", "[%date] [%level] [%module] %message", true);
69: }
70:
71: /**
72: * Sets the module to use.
73: *
74: * setModule automatically buffers basic module information to the
75: * log to assist the developer in debugging his modules.
76: *
77: * @deprecated [2015-05-21]
78: * This method is no longer supported (no replacement)
79: * @param int $idmod
80: * The module ID to use
81: * @throws cException
82: * if the module with the given idmod could not be loaded
83: */
84: public function setModule($idmod) {
85: cDeprecated("The cModuleLog setModule method are no longer supported.");
86:
87: $this->_module = new cApiModule($idmod);
88: if ($this->_module->isLoaded() == false) {
89: throw new cException('Could not load module information.');
90: }
91: }
92:
93: /**
94: * Shortcut Handler Module.
95: * Returns the ID and the name of the module.
96: *
97: * @deprecated [2015-05-21]
98: * This method is no longer supported (no replacement)
99: * @return string
100: * ID and name of the module
101: */
102: public function shModule() {
103: cDeprecated("The cModuleLog shModule method are no longer supported.");
104:
105: if ($this->_module->isLoaded() == false) {
106: return '';
107: }
108:
109: return $this->_module->get("idmod") . ": " . $this->_module->get("name");
110: }
111:
112: }
113: