API16

JError/handleLog: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Log error handler Logs the error message to a system log file <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JError/handleLog|Edi...
 
m preparing for archive only
 
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:




<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JError/handleLog|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JError/handleLog}}
 
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 19: Line 17:
!Description
!Description
|-
|-
|  
| &$error
|  
|  
|  $error  object to handle  
|  $error  object to handle  
Line 59: Line 57:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JError/handleLog|Edit See Also]]<nowiki>]</nowiki>
<! removed transcluded page call, red link never existed >
</span>
{{SeeAlso:JError/handleLog}}


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=handleLog
  category=handleLog
  category=JError
  category=JError
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API16]]

Latest revision as of 01:36, 25 March 2017

Description

Log error handler Logs the error message to a system log file



<! removed transcluded page call, red link never existed >

Syntax

static handleLog(&$error, $options)
Parameter Name Default Value Description
&$error $error object to handle
$options $options Handler options

Returns

object The exception object

Defined in

libraries/joomla/error/error.php

Importing

jimport( 'joomla.error.error' );

Source Body

public static function handleLog(& $error, $options)
{
        static $log;

        if ($log == null)
        {
                jimport('joomla.error.log');
                $fileName = date('Y-m-d').'.error.log';
                $options['format'] = "{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}";
                $log = & JLog::getInstance($fileName, $options);
        }

        $entry['level'] = $error->get('level');
        $entry['code'] = $error->get('code');
        $entry['message'] = str_replace(array ("\r","\n"), array ('','\\n'), $error->get('message'));
        $log->addEntry($entry);

        return $error;
}


<! removed transcluded page call, red link never existed >

Examples

Code Examples