Introduce a function to return a warning by loggers.

This commit is contained in:
Laurent Destailleur 2015-09-07 12:21:26 +02:00
parent f3c71a9a5a
commit 28c62fb214
4 changed files with 42 additions and 7 deletions

View File

@ -225,7 +225,11 @@ foreach ($syslogModules as $moduleName)
print '<td align="left">';
if ($module->getInfo())
{
print $form->textwithpicto('', $module->getInfo());
print $form->textwithpicto('', $module->getInfo(), 1, 'help');
}
if ($module->getWarning())
{
print $form->textwithpicto('', $module->getWarning(), 1, 'warning');
}
print '</td>';
print "</tr>\n";

View File

@ -28,13 +28,23 @@ class LogHandler
/**
* Content of the info tooltip.
*
* @return false|string
* @return string
*/
public function getInfo()
{
return false;
return '';
}
/**
* Return warning if something is wrong with logger
*
* @return string
*/
public function getWarning()
{
return '';
}
/**
* Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development')
*

View File

@ -48,6 +48,13 @@ interface LogHandlerInterface
*/
public function getInfo();
/**
* Return warning if something is wrong with logger
*
* @return string Warning message
*/
public function getWarning();
/**
* Return array of configuration data
*

View File

@ -32,19 +32,29 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
/**
* Content of the info tooltip.
*
* @return false|string
* @return string
*/
public function getInfo()
{
return '';
}
/**
* Return warning if something is wrong with logger
*
* @return string
*/
public function getWarning()
{
global $langs;
return $this->isActive()?'':$langs->trans('ClassNotFoundIntoPathWarning','ChromePhp.class.php');
}
/**
* Is the module active ?
*
* @return int
* @return int -1 if not active, 0 if active but lib/path not found, 1 if OK
*/
public function isActive()
{
@ -65,6 +75,10 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
{
return 1;
}
else
{
return 0;
}
}
catch(Exception $e)
{
@ -89,7 +103,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH',
'default' => DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/',
'attr' => 'size="60"',
'example' =>'/usr/share/php'
'example' =>'/usr/share/php, '.DOL_DOCUMENT_ROOT . '/includes/ccampbell/chromephp/'
)
);
}