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

Public Member Functions

 Log_error_log ($name, $ident='', $conf=array(), $level=PEAR_LOG_DEBUG)
 Constructs a new Log_error_log object. More...
 
 open ()
 Opens the handler. More...
 
 close ()
 Closes the handler. More...
 
 log ($message, $priority=null)
 Logs $message using PHP's error_log() function. More...
 
- Public Member Functions inherited from Log
 _classExists ($class)
 Utility function which wraps PHP's class_exists() function to ensure consistent behavior between PHP versions 4 and 5. More...
 
factory ($handler, $name='', $ident='', $conf=array(), $level=PEAR_LOG_DEBUG)
 Attempts to return a concrete Log instance of type $handler. More...
 
singleton ($handler, $name='', $ident='', $conf=array(), $level=PEAR_LOG_DEBUG)
 Attempts to return a reference to a concrete Log instance of type $handler, only creating a new instance if no log instance with the same parameters currently exists. More...
 
 open ()
 Abstract implementation of the open() method. More...
 
 close ()
 Abstract implementation of the close() method. More...
 
 flush ()
 Abstract implementation of the flush() method. More...
 
 log ($message, $priority=null)
 Abstract implementation of the log() method. More...
 
 emerg ($message)
 A convenience function for logging a emergency event. More...
 
 alert ($message)
 A convenience function for logging an alert event. More...
 
 crit ($message)
 A convenience function for logging a critical event. More...
 
 err ($message)
 A convenience function for logging a error event. More...
 
 warning ($message)
 A convenience function for logging a warning event. More...
 
 notice ($message)
 A convenience function for logging a notice event. More...
 
 info ($message)
 A convenience function for logging a information event. More...
 
 debug ($message)
 A convenience function for logging a debug event. More...
 
 _extractMessage ($message)
 Returns the string representation of the message data. More...
 
 _getBacktraceVars ($depth)
 Using debug_backtrace(), returns the file, line, and enclosing function name of the source code context from which log() was invoked. More...
 
 _format ($format, $timestamp, $priority, $message)
 Produces a formatted log line based on a format string and a set of variables representing the current log record and state. More...
 
 priorityToString ($priority)
 Returns the string representation of a PEAR_LOG_* integer constant. More...
 
 stringToPriority ($name)
 Returns the the PEAR_LOG_* integer constant for the given string representation of a priority name. More...
 
 MASK ($priority)
 Calculate the log mask for the given priority. More...
 
 UPTO ($priority)
 Calculate the log mask for all priorities up to the given priority. More...
 
 MIN ($priority)
 Calculate the log mask for all priorities greater than or equal to the given priority. More...
 
 MAX ($priority)
 Calculate the log mask for all priorities less than or equal to the given priority. More...
 
 setMask ($mask)
 Set and return the level mask for the current Log instance. More...
 
 getMask ()
 Returns the current level mask. More...
 
 _isMasked ($priority)
 Check if the given priority is included in the current level mask. More...
 
 getPriority ()
 Returns the current default priority. More...
 
 setPriority ($priority)
 Sets the default priority to the specified value. More...
 
 attach (&$observer)
 Adds a Log_observer instance to the list of observers that are listening for messages emitted by this Log instance. More...
 
 detach ($observer)
 Removes a Log_observer instance from the list of observers. More...
 
 _announce ($event)
 Informs each registered observer instance that a new message has been logged. More...
 
 isComposite ()
 Indicates whether this is a composite class. More...
 
 setIdent ($ident)
 Sets this Log instance's identification string. More...
 
 getIdent ()
 Returns the current identification string. More...
 

Data Fields

 $_type = PEAR_LOG_TYPE_SYSTEM
 
 $_destination = ''
 
 $_extra_headers = ''
 
 $_lineFormat = '%2$s: %4$s'
 
 $_timeFormat = '%b %d %H:%M:%S'
 
- Data Fields inherited from Log
 $_opened = false
 
 $_id = 0
 
 $_ident = ''
 
 $_priority = PEAR_LOG_INFO
 
 $_mask = PEAR_LOG_ALL
 
 $_listeners = array()
 
 $_formatMap
 

Detailed Description

Definition at line 19 of file error_log.php.

Member Function Documentation

◆ close()

Log_error_log::close ( )

Closes the handler.

@access public

Since
Log 1.9.6

Reimplemented from Log.

Definition at line 113 of file error_log.php.

114 {
115 $this->_opened = false;
116 return true;
117 }

◆ log()

Log_error_log::log (   $message,
  $priority = null 
)

Logs $message using PHP's error_log() function.

The message is also passed along to any Log_observer instances that are observing this Log.

Parameters
mixed$messageString or object containing the message to log.
string$priorityThe priority of the message. Valid values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT, PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING, PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
Returns
boolean True on success or false on failure. @access public

Reimplemented from Log.

Definition at line 131 of file error_log.php.

132 {
133 /* If a priority hasn't been specified, use the default value. */
134 if ($priority === null) {
135 $priority = $this->_priority;
136 }
137
138 /* Abort early if the priority is above the maximum logging level. */
139 if (!$this->_isMasked($priority)) {
140 return false;
141 }
142
143 /* Extract the string representation of the message. */
144 $message = $this->_extractMessage($message);
145
146 /* Build the string containing the complete log line. */
147 $line = $this->_format($this->_lineFormat,
148 strftime($this->_timeFormat),
149 $priority, $message);
150
151 /* Pass the log line and parameters to the error_log() function. */
152 $success = error_log($line, $this->_type, $this->_destination,
153 $this->_extra_headers);
154
155 $this->_announce(array('priority' => $priority, 'message' => $message));
156
157 return $success;
158 }
$success
Definition: Utf8Test.php:87
$_priority
Definition: Log.php:69
_isMasked($priority)
Check if the given priority is included in the current level mask.
Definition: Log.php:726
_announce($event)
Informs each registered observer instance that a new message has been logged.
Definition: Log.php:811
_extractMessage($message)
Returns the string representation of the message data.
Definition: Log.php:417
_format($format, $timestamp, $priority, $message)
Produces a formatted log line based on a format string and a set of variables representing the curren...
Definition: Log.php:530

References Log\$_priority, $success, Log\_announce(), Log\_extractMessage(), Log\_format(), Log\_isMasked(), and Monolog\Handler\error_log().

+ Here is the call graph for this function:

◆ Log_error_log()

Log_error_log::Log_error_log (   $name,
  $ident = '',
  $conf = array(),
  $level = PEAR_LOG_DEBUG 
)

Constructs a new Log_error_log object.

Parameters
string$nameIgnored.
string$identThe identity string.
array$confThe configuration array.
int$levelLog messages up to and including this level. @access public

Definition at line 68 of file error_log.php.

70 {
71 $this->_id = md5(microtime());
72 $this->_type = $name;
73 $this->_ident = $ident;
74 $this->_mask = Log::UPTO($level);
75
76 if (!empty($conf['destination'])) {
77 $this->_destination = $conf['destination'];
78 }
79
80 if (!empty($conf['extra_headers'])) {
81 $this->_extra_headers = $conf['extra_headers'];
82 }
83
84 if (!empty($conf['lineFormat'])) {
85 $this->_lineFormat = str_replace(array_keys($this->_formatMap),
86 array_values($this->_formatMap),
87 $conf['lineFormat']);
88 }
89
90 if (!empty($conf['timeFormat'])) {
91 $this->_timeFormat = $conf['timeFormat'];
92 }
93 }
UPTO($priority)
Calculate the log mask for all priorities up to the given priority.
Definition: Log.php:642

References Log\UPTO().

+ Here is the call graph for this function:

◆ open()

Log_error_log::open ( )

Opens the handler.

@access public

Since
Log 1.9.6

Reimplemented from Log.

Definition at line 101 of file error_log.php.

102 {
103 $this->_opened = true;
104 return true;
105 }

Field Documentation

◆ $_destination

Log_error_log::$_destination = ''

Definition at line 33 of file error_log.php.

◆ $_extra_headers

Log_error_log::$_extra_headers = ''

Definition at line 41 of file error_log.php.

◆ $_lineFormat

Log_error_log::$_lineFormat = '%2$s: %4$s'

Definition at line 48 of file error_log.php.

◆ $_timeFormat

Log_error_log::$_timeFormat = '%b %d %H:%M:%S'

Definition at line 57 of file error_log.php.

◆ $_type

Log_error_log::$_type = PEAR_LOG_TYPE_SYSTEM

Definition at line 26 of file error_log.php.


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