Added some fluidity to Tlog setters

This commit is contained in:
Franck Allimant
2014-01-21 00:59:03 +01:00
parent 70651c2f32
commit 9fba3e4065

View File

@@ -164,6 +164,8 @@ class Tlog Implements LoggerInterface
$this->loadDestinations($this->destinations, $classes_destinations);
}
return $this;
}
/**
@@ -185,11 +187,15 @@ class Tlog Implements LoggerInterface
public function setLevel($level)
{
$this->level = $level;
return $this;
}
public function setPrefix($prefixe)
{
$this->prefixe = $prefixe;
return $this;
}
public function setFiles($files)
@@ -197,17 +203,23 @@ class Tlog Implements LoggerInterface
$this->files = explode(";", $files);
$this->all_files = in_array('*', $this->files);
return $this;
}
public function setIp($ips)
{
// isset($_SERVER['REMOTE_ADDR']) if we are in cli mode
if (! empty($ips) && isset($_SERVER['REMOTE_ADDR']) && ! in_array($_SERVER['REMOTE_ADDR'], explode(";", $ips))) $this->level = self::MUET;
return $this;
}
public function setShowRedirect($bool)
{
$this->show_redirect = $bool;
return $this;
}
// Configuration d'une destination
@@ -216,6 +228,8 @@ class Tlog Implements LoggerInterface
if (isset($this->destinations[$destination])) {
$this->destinations[$destination]->setConfig($param, $valeur);
}
return $this;
}
// Configuration d'une destination
@@ -650,11 +664,7 @@ class Tlog Implements LoggerInterface
{
$text = '';
/*if (is_array($message)) {
foreach ($message as $arg) {
$text .= is_scalar($arg) ? $arg : print_r($arg, true);
}
} else */ if (is_scalar($message) === false) {
if (is_scalar($message) === false) {
$text = print_r($message, true);
} else {
$text = $message;