JLog/getInstance
From Joomla! Documentation
< API16:JLog
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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.
Template:Description:JLog/getInstance
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];
}
[Edit See Also] Template:SeeAlso:JLog/getInstance
Examples[edit]
<CodeExamplesForm />