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">'; print '<td align="left">';
if ($module->getInfo()) 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 '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -28,11 +28,21 @@ class LogHandler
/** /**
* Content of the info tooltip. * Content of the info tooltip.
* *
* @return false|string * @return string
*/ */
public function getInfo() public function getInfo()
{ {
return false; return '';
}
/**
* Return warning if something is wrong with logger
*
* @return string
*/
public function getWarning()
{
return '';
} }
/** /**

View File

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

View File

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