Actions

API16

Difference between revisions of "JLog/getInstance"

From Joomla! Documentation

< API16:JLog
(New page: ===Description=== Returns the global log object, only creating it if it doesn't already exist. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JLog/g...)
 
m (removing red link to edit, no existant pages)
 
Line 3: Line 3:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JLog/getInstance|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JLog/getInstance}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 68: Line 68:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JLog/getInstance|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JLog/getInstance}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
Line 83: Line 83:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API16]]

Latest revision as of 22:05, 13 May 2013

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Returns the global log object, only creating it if it doesn't already exist.

[<! removed edit link to red link >]

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

Syntax

static getInstance($file= 'error.php', $options=null, $path=null)
Parameter Name Default Value Description
$file 'error.php'
$options null
$path null

Returns

object The object.

Defined in

libraries/joomla/error/log.php

Importing

jimport( 'joomla.error.log' );

Source Body

static function getInstance($file = 'error.php', $options = null, $path = null)
{
        static $instances;
 
        // Set default path if not set
        if (!$path)
        {
                $config = &JFactory::getConfig();
                $path = $config->getValue('config.log_path');
        }
 
        jimport('joomla.filesystem.path');
        $path = JPath :: clean($path . DS . $file);
        $sig = md5($path);
 
        if (!isset ($instances)) {
                $instances = array ();
        }
 
        if (empty ($instances[$sig])) {
                $instances[$sig] = new JLog($path, $options);
        }
 
        return $instances[$sig];
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />