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 (preparing for archive only)
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
Returns the global log object, only creating it if it doesn't already exist.
 
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/getInstance|Edit Descripton]]<nowiki>]</nowiki>
 
</span>
 
  
{{Description:JLog/getInstance}}
+
 
 +
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 67: Line 65:
 
</source>
 
</source>
  
<span class="editsection" style="font-size:76%;">
+
 
<nowiki>[</nowiki>[[SeeAlso:JLog/getInstance|Edit See Also]]<nowiki>]</nowiki>
+
<! removed transcluded page call, red link never existed >
</span>
 
{{SeeAlso:JLog/getInstance}}
 
  
 
===Examples===
 
===Examples===
<CodeExamplesForm />
+
=== Code Examples ===
 
<dpl>
 
<dpl>
 
  noresultsheader=\n
 
  noresultsheader=\n
 
  category=getInstance
 
  category=getInstance
 
  category=JLog
 
  category=JLog
  category=CodeExample
+
  namespace=CodeExample
 
  category=MethodExample
 
  category=MethodExample
 
  include=*
 
  include=*
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API16]]

Latest revision as of 20:53, 24 March 2017

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

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


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

Syntax[edit]

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

Returns[edit]

object The object.

Defined in[edit]

libraries/joomla/error/log.php

Importing[edit]

jimport( 'joomla.error.log' );

Source Body[edit]

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 transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]