Add all the phpdocs to the domframework

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1246 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-03-24 19:44:34 +00:00
parent 1b52b410c3
commit 350aa1dea8
28 changed files with 472 additions and 148 deletions

View File

@@ -1,4 +1,10 @@
<?php
/** DomFramework
@package domframework
@author Dominique Fournier <dominique@fournier38.fr> */
/** The logger class permit to log the informations from the soft
It allow to debug too */
class logger
{
/* The logger class can be used with :
@@ -10,16 +16,23 @@ class logger
$d->logwrite ("Super log DEBUG", $d::DEBUG);
$d->logwrite ("Super log NOTICE", $d::NOTICE); */
// TODO : Add SQL support
public $logtype = "display"; // display, file, syslog
// can be merged with a pipe : "display|syslog"
/** The method to log.
Can be display, file, syslog
Can be merged with a pipe : "display|syslog"*/
public $logtype = "display";
/** For logtype=file, the filename to use */
public $logfile = FALSE;
/** Timezone use to save the logs */
public $timezone = "UTC";
/** Minimum log level in the logs */
public $loglevelmin = LOG_NOTICE;
// See http://fr2.php.net/manual/en/function.openlog.php for $syslogFacility
/** In Syslog mode, the facility to use
See http://fr2.php.net/manual/en/function.openlog.php for $syslogFacility */
public $syslogFacility = LOG_USER;
/** In Syslog, prefix the log by the text */
public $syslogPrefix = FALSE;
/* Priorities :
/** The priorities which can be used in the priorities
LOG_EMERG system is unusable
LOG_ALERT action must be taken immediately
LOG_CRIT critical conditions
@@ -37,7 +50,9 @@ class logger
LOG_INFO => "INFO",
LOG_DEBUG => "DEBUG");
/** Store a new message log in the log manager defined by $logtype */
/** Store a new message log in the log manager defined by $logtype
@param string $message Message to log
@param integer|null $priority Priority to use */
public function log ($message, $priority=LOG_NOTICE)
{
if ($this->loglevelmin < $priority)
@@ -53,7 +68,9 @@ class logger
$this->logsyslog ($message, $priority);
}
/** Log $message on file */
/** Log $message on file
@param string $message Message to log
@param integer|null $priority Priority to use */
private function logfile ($message, $priority)
{
if ($this->logfile === FALSE)
@@ -86,8 +103,9 @@ class logger
file_put_contents ($this->logfile, $message, FILE_APPEND);
}
/** Log $message on screen with adding date. Add the HTML flags if not in CLI
*/
/** Log $message on screen with adding date. Add the HTML flags if not in CLI.
@param string $message Message to log
@param integer|null $priority Priority to use */
private function logdisplay ($message, $priority)
{
if (php_sapi_name () !== "cli")
@@ -101,7 +119,9 @@ class logger
echo "\n";
}
/** Log $message on syslog */
/** Log $message on syslog
@param string $message Message to log
@param integer|null $priority Priority to use */
private function logsyslog ($message, $priority)
{
openlog ($this->syslogPrefix, NULL, $this->syslogFacility);