Inital commit

This commit is contained in:
2020-11-19 15:36:28 +01:00
parent 71f32f83d3
commit 66ce4ee218
18077 changed files with 2166122 additions and 35184 deletions

View File

@@ -15,15 +15,15 @@ namespace Thelia\Log;
abstract class AbstractTlogDestination
{
//Tableau de TlogDestinationConfig paramétrant la destination
protected $_configs = array();
protected $configs = array();
//Tableau des lignes de logs stockés avant utilisation par ecrire()
protected $_logs = array();
protected $logs = array();
public function __construct()
{
// Initialiser les variables de configuration
$this->_configs = $this->getConfigs();
$this->configs = $this->getConfigs();
// Appliquer la configuration
$this->configure();
@@ -32,12 +32,14 @@ abstract class AbstractTlogDestination
//Affecte une valeur à une configuration de la destination
public function setConfig($name, $value, $apply_changes = true)
{
foreach ($this->_configs as $config) {
foreach ($this->configs as $config) {
if ($config->getName() == $name) {
$config->setValue($value);
// Appliquer les changements
if ($apply_changes) $this->configure();
if ($apply_changes) {
$this->configure();
}
return true;
}
}
@@ -48,7 +50,7 @@ abstract class AbstractTlogDestination
//Récupère la valeur affectée à une configuration de la destination
public function getConfig($name, $default = false)
{
foreach ($this->_configs as $config) {
foreach ($this->configs as $config) {
if ($config->getName() == $name) {
return $config->getValue();
}
@@ -59,13 +61,13 @@ abstract class AbstractTlogDestination
public function getConfigs()
{
return $this->_configs;
return $this->configs;
}
//Ajoute une ligne de logs à la destination
public function add($string)
{
$this->_logs[] = $string;
$this->logs[] = $string;
}
protected function insertAfterBody(&$res, $logdata)
@@ -73,7 +75,7 @@ abstract class AbstractTlogDestination
$match = array();
if (preg_match("/(<body[^>]*>)/i", $res, $match)) {
$res = str_replace($match[0], $match[0] . "\n" . $logdata, $res);
$res = str_replace($match[0], $match[0] . "\n" . $logdata, $res);
}
}