This commit is contained in:
Laurent Destailleur 2012-11-11 17:50:24 +01:00
parent f9dec36d7a
commit 842982f134
6 changed files with 148 additions and 31 deletions

View File

@ -28,7 +28,7 @@ class LogHandler
} }
/** /**
* ¿Is the module active? * Is the module active ?
* *
* @return boolean * @return boolean
*/ */

View File

@ -1,12 +1,58 @@
<?php <?php
/**
* LogHandlerInterface
*/
interface LogHandlerInterface interface LogHandlerInterface
{ {
/**
* Return name of logger
*
* @return string Name of logger
*/
public function getName(); public function getName();
/**
* Return version of logger
*
* @return string Version of logger
*/
public function getVersion(); public function getVersion();
/**
* Return information on logger
*
* @return string Version of logger
*/
public function getInfo(); public function getInfo();
/**
* Return array of configuration data
*
* @return array Return array of configuration data
*/
public function configure(); public function configure();
/**
* Return if configuration is valid
*
* @return boolean True if configuration ok
*/
public function checkConfiguration(); public function checkConfiguration();
/**
* Return if logger active
*
* @return boolen True if active
*/
public function isActive(); public function isActive();
/**
* Output log content
*
* @param string $content Content to log
* @return void
*/
public function export($content); public function export($content);
} }

View File

@ -2,10 +2,15 @@
require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
/**
* Class to manage logging to ChromPHP
*/
class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
{ {
/** /**
* {@inheritDoc} * Return name of logger
*
* @return string Name of logger
*/ */
public function getName() public function getName()
{ {
@ -13,7 +18,9 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development')
*
* @return string
*/ */
public function getVersion() public function getVersion()
{ {
@ -21,7 +28,9 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Content of the info tooltip.
*
* @return false|string
*/ */
public function getInfo() public function getInfo()
{ {
@ -31,7 +40,9 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Is the module active ?
*
* @return boolean
*/ */
public function isActive() public function isActive()
{ {
@ -56,7 +67,9 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Return array of configuration data
*
* @return array Return array of configuration data
*/ */
public function configure() public function configure()
{ {
@ -73,7 +86,9 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Return if configuration is valid
*
* @return boolean True if configuration ok
*/ */
public function checkConfiguration() public function checkConfiguration()
{ {
@ -95,7 +110,10 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Output log content
*
* @param string $content Content to log
* @return void
*/ */
public function export($content) public function export($content)
{ {

View File

@ -2,10 +2,15 @@
require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
/**
* Class to manage logging to a file
*/
class mod_syslog_file extends LogHandler implements LogHandlerInterface class mod_syslog_file extends LogHandler implements LogHandlerInterface
{ {
/** /**
* {@inheritDoc} * Return name of logger
*
* @return string Name of logger
*/ */
public function getName() public function getName()
{ {
@ -15,7 +20,9 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development')
*
* @return string
*/ */
public function getVersion() public function getVersion()
{ {
@ -23,7 +30,9 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Content of the info tooltip.
*
* @return false|string
*/ */
public function getInfo() public function getInfo()
{ {
@ -33,7 +42,9 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Is the module active ?
*
* @return boolean
*/ */
public function isActive() public function isActive()
{ {
@ -41,7 +52,9 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Return array of configuration data
*
* @return array Return array of configuration data
*/ */
public function configure() public function configure()
{ {
@ -58,7 +71,9 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Return if configuration is valid
*
* @return boolean True if configuration ok
*/ */
public function checkConfiguration() public function checkConfiguration()
{ {
@ -79,6 +94,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
/** /**
* Return the parsed logfile path * Return the parsed logfile path
*
* @return string * @return string
*/ */
private function getFilename() private function getFilename()
@ -88,7 +104,9 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
/** /**
* Export the message * Export the message
*
* @param array $content Array containing the info about the message * @param array $content Array containing the info about the message
* @return void
*/ */
public function export($content) public function export($content)
{ {

View File

@ -2,10 +2,15 @@
require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
/**
* Class to manage logging to a FirePHP
*/
class mod_syslog_firephp extends LogHandler implements LogHandlerInterface class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
{ {
/** /**
* {@inheritDoc} * Return name of logger
*
* @return string Name of logger
*/ */
public function getName() public function getName()
{ {
@ -13,7 +18,9 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development')
*
* @return string
*/ */
public function getVersion() public function getVersion()
{ {
@ -21,7 +28,9 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Content of the info tooltip.
*
* @return false|string
*/ */
public function getInfo() public function getInfo()
{ {
@ -31,7 +40,9 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Is the module active ?
*
* @return boolean
*/ */
public function isActive() public function isActive()
{ {
@ -54,7 +65,9 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
} }
///** ///**
// * {@inheritDoc} // * Return array of configuration data
// *
// * @return array Return array of configuration data
// */ // */
// public function configure() // public function configure()
// { // {
@ -71,7 +84,9 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
// } // }
/** /**
* {@inheritDoc} * Return if configuration is valid
*
* @return boolean True if configuration ok
*/ */
public function checkConfiguration() public function checkConfiguration()
{ {
@ -93,7 +108,10 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Output log content
*
* @param string $content Content to log
* @return void
*/ */
public function export($content) public function export($content)
{ {

View File

@ -2,10 +2,15 @@
require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
/**
* Class to manage logging to syslog
*/
class mod_syslog_syslog extends LogHandler implements LogHandlerInterface class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
{ {
/** /**
* {@inheritDoc} * Return name of logger
*
* @return string Name of logger
*/ */
public function getName() public function getName()
{ {
@ -13,7 +18,9 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Version of the module ('x.y.z' or 'dolibarr' or 'experimental' or 'development')
*
* @return string
*/ */
public function getVersion() public function getVersion()
{ {
@ -21,7 +28,9 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Content of the info tooltip.
*
* @return false|string
*/ */
public function getInfo() public function getInfo()
{ {
@ -31,7 +40,9 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Is the module active ?
*
* @return boolean
*/ */
public function isActive() public function isActive()
{ {
@ -45,7 +56,9 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Return array of configuration data
*
* @return array Return array of configuration data
*/ */
public function configure() public function configure()
{ {
@ -61,7 +74,9 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
} }
/** /**
* {@inheritDoc} * Return if configuration is valid
*
* @return boolean True if configuration ok
*/ */
public function checkConfiguration() public function checkConfiguration()
{ {
@ -87,7 +102,9 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
/** /**
* Export the message * Export the message
*
* @param array $content Array containing the info about the message * @param array $content Array containing the info about the message
* @return void
*/ */
public function export($content) public function export($content)
{ {