ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Log_observer Class Reference
+ Collaboration diagram for Log_observer:

Public Member Functions

 Log_observer ($priority=PEAR_LOG_INFO)
 Creates a new basic Log_observer instance. More...
 
factory ($type, $priority=PEAR_LOG_INFO, $conf=array())
 Attempts to return a new concrete Log_observer instance of the requested type. More...
 
 notify ($event)
 This is a stub method to make sure that Log_Observer classes do something when they are notified of a message. More...
 

Data Fields

 $_id = 0
 
 $_priority = PEAR_LOG_INFO
 

Detailed Description

Definition at line 21 of file observer.php.

Member Function Documentation

◆ factory()

& Log_observer::factory (   $type,
  $priority = PEAR_LOG_INFO,
  $conf = array() 
)

Attempts to return a new concrete Log_observer instance of the requested type.

Parameters
string$typeThe type of concreate Log_observer subclass to return.
integer$priorityThe highest priority at which to receive log event notifications.
array$confOptional associative array of additional configuration values.
Returns
object The newly created concrete Log_observer instance, or null on an error.

Definition at line 70 of file observer.php.

71 {
72 $type = strtolower($type);
73 $class = 'Log_observer_' . $type;
74
75 /*
76 * If the desired class already exists (because the caller has supplied
77 * it from some custom location), simply instantiate and return a new
78 * instance.
79 */
80 if (class_exists($class)) {
81 $object = new $class($priority, $conf);
82 return $object;
83 }
84
85 /* Support both the new-style and old-style file naming conventions. */
86 $newstyle = true;
87 $classfile = dirname(__FILE__) . '/observer_' . $type . '.php';
88
89 if (!file_exists($classfile)) {
90 $classfile = 'Log/' . $type . '.php';
91 $newstyle = false;
92 }
93
94 /*
95 * Attempt to include our version of the named class, but don't treat
96 * a failure as fatal. The caller may have already included their own
97 * version of the named class.
98 */
99 @include_once $classfile;
100
101 /* If the class exists, return a new instance of it. */
102 if (class_exists($class)) {
103 /* Support both new-style and old-style construction. */
104 if ($newstyle) {
105 $object = new $class($priority, $conf);
106 } else {
107 $object = new $class($priority);
108 }
109 return $object;
110 }
111
112 $null = null;
113 return $null;
114 }

◆ Log_observer()

Log_observer::Log_observer (   $priority = PEAR_LOG_INFO)

Creates a new basic Log_observer instance.

Parameters
integer$priorityThe highest priority at which to receive log event notifications.

@access public

Definition at line 50 of file observer.php.

51 {
52 $this->_id = md5(microtime());
53 $this->_priority = $priority;
54 }

◆ notify()

Log_observer::notify (   $event)

This is a stub method to make sure that Log_Observer classes do something when they are notified of a message.

The default behavior is to just print the message, which is obviously not desireable in practically any situation - which is why you need to override this method. :)

Parameters
array$eventA hash describing the log event.

Definition at line 125 of file observer.php.

126 {
127 print_r($event);
128 }

Field Documentation

◆ $_id

Log_observer::$_id = 0

Definition at line 29 of file observer.php.

◆ $_priority

Log_observer::$_priority = PEAR_LOG_INFO

Definition at line 40 of file observer.php.


The documentation for this class was generated from the following file: