fix some CS
This commit is contained in:
@@ -25,9 +25,9 @@ namespace Thelia\Log\Destination;
|
||||
|
||||
use Thelia\Log\AbstractTlogDestination;
|
||||
use Thelia\Log\TlogDestinationConfig;
|
||||
|
||||
class TlogDestinationFile extends AbstractTlogDestination {
|
||||
|
||||
class TlogDestinationFile extends AbstractTlogDestination
|
||||
{
|
||||
// Nom des variables de configuration
|
||||
// ----------------------------------
|
||||
const VAR_PATH_FILE = "tlog_destinationfile_path";
|
||||
@@ -39,21 +39,22 @@ class TlogDestinationFile extends AbstractTlogDestination {
|
||||
protected $path_defaut = false;
|
||||
protected $fh = false;
|
||||
|
||||
public function __construct($configModel = null) {
|
||||
|
||||
public function __construct($configModel = null)
|
||||
{
|
||||
$this->path_defaut = THELIA_ROOT . "log/" . self::TLOG_DEFAULT_NAME;
|
||||
$this->setConfigModel($configModel);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function configurer($config = false) {
|
||||
public function configurer($config = false)
|
||||
{
|
||||
$file_path = $this->get_config(self::VAR_PATH_FILE);
|
||||
$mode = strtolower($this->get_config(self::VAR_MODE)) == 'a' ? 'a' : 'w';
|
||||
|
||||
if (! empty($file_path)) {
|
||||
if (! is_file($file_path)) {
|
||||
$dir = dirname($file_path);
|
||||
if(! is_dir($dir)) {
|
||||
if (! is_dir($dir)) {
|
||||
mkdir($dir, 0777, true);
|
||||
}
|
||||
}
|
||||
@@ -64,15 +65,18 @@ class TlogDestinationFile extends AbstractTlogDestination {
|
||||
}
|
||||
}
|
||||
|
||||
public function get_titre() {
|
||||
public function get_titre()
|
||||
{
|
||||
return "Text File";
|
||||
}
|
||||
|
||||
public function get_description() {
|
||||
public function get_description()
|
||||
{
|
||||
return "Store logs into text file";
|
||||
}
|
||||
|
||||
public function get_configs() {
|
||||
public function get_configs()
|
||||
{
|
||||
return array(
|
||||
new TlogDestinationConfig(
|
||||
self::VAR_PATH_FILE,
|
||||
@@ -93,13 +97,15 @@ class TlogDestinationFile extends AbstractTlogDestination {
|
||||
);
|
||||
}
|
||||
|
||||
public function ajouter($texte) {
|
||||
public function ajouter($texte)
|
||||
{
|
||||
if ($this->fh) {
|
||||
fwrite($this->fh, $texte."\n");
|
||||
}
|
||||
}
|
||||
|
||||
public function ecrire(&$res) {
|
||||
public function ecrire(&$res)
|
||||
{
|
||||
if ($this->fh) @fclose($this->fh);
|
||||
|
||||
$this->fh = false;
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace Thelia\Log\Destination;
|
||||
|
||||
use Thelia\Log\AbstractTlogDestination;
|
||||
|
||||
class TlogDestinationHtml extends AbstractTlogDestination {
|
||||
|
||||
class TlogDestinationHtml extends AbstractTlogDestination
|
||||
{
|
||||
// Nom des variables de configuration
|
||||
// ----------------------------------
|
||||
const VAR_STYLE = "tlog_destinationhtml_style";
|
||||
@@ -34,24 +34,29 @@ class TlogDestinationHtml extends AbstractTlogDestination {
|
||||
|
||||
private $style;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
}
|
||||
|
||||
public function configurer($config = false) {
|
||||
public function configurer($config = false)
|
||||
{
|
||||
$this->style = $this->get_config(self::VAR_STYLE);
|
||||
}
|
||||
|
||||
public function get_titre() {
|
||||
public function get_titre()
|
||||
{
|
||||
return "Affichage direct dans la page, en HTML";
|
||||
}
|
||||
|
||||
public function get_description() {
|
||||
public function get_description()
|
||||
{
|
||||
return "Permet d'afficher les logs directement dans la page resultat, avec une mise en forme HTML.";
|
||||
}
|
||||
|
||||
public function get_configs() {
|
||||
public function get_configs()
|
||||
{
|
||||
// return array(
|
||||
// new TlogDestinationConfig(
|
||||
// self::VAR_STYLE,
|
||||
@@ -63,10 +68,10 @@ class TlogDestinationHtml extends AbstractTlogDestination {
|
||||
// );
|
||||
}
|
||||
|
||||
public function ecrire(&$res) {
|
||||
|
||||
public function ecrire(&$res)
|
||||
{
|
||||
$block = sprintf('<pre class="tlog-trace" style="%s">%s</pre>', $this->style, htmlspecialchars(implode("\n", $this->_logs)));
|
||||
|
||||
$this->inserer_apres_body($res, $block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,21 +25,25 @@ namespace Thelia\Log\Destination;
|
||||
|
||||
use Thelia\Log\AbstractTlogDestination;
|
||||
|
||||
class TlogDestinationNull extends AbstractTlogDestination {
|
||||
|
||||
public function get_titre() {
|
||||
class TlogDestinationNull extends AbstractTlogDestination
|
||||
{
|
||||
public function get_titre()
|
||||
{
|
||||
return "Trou noir";
|
||||
}
|
||||
|
||||
public function get_description() {
|
||||
public function get_description()
|
||||
{
|
||||
return "Cette destination ne provoque aucune sortie";
|
||||
}
|
||||
|
||||
public function ajouter($string) {
|
||||
public function ajouter($string)
|
||||
{
|
||||
// Rien
|
||||
}
|
||||
|
||||
public function ecrire(&$res) {
|
||||
public function ecrire(&$res)
|
||||
{
|
||||
// Rien
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,26 +25,30 @@ namespace Thelia\Log\Destination;
|
||||
|
||||
use Thelia\Log\AbstractTlogDestination;
|
||||
|
||||
|
||||
class TlogDestinationText extends AbstractTlogDestination {
|
||||
|
||||
public function __construct() {
|
||||
class TlogDestinationText extends AbstractTlogDestination
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function get_titre() {
|
||||
public function get_titre()
|
||||
{
|
||||
return "Affichage direct dans la page, en texte brut";
|
||||
}
|
||||
|
||||
public function get_description() {
|
||||
public function get_description()
|
||||
{
|
||||
return "Permet d'afficher les logs directement dans la page resultat, au format texte brut.";
|
||||
}
|
||||
|
||||
public function ajouter($texte) {
|
||||
public function ajouter($texte)
|
||||
{
|
||||
echo $texte."\n";
|
||||
}
|
||||
|
||||
public function ecrire(&$res) {
|
||||
public function ecrire(&$res)
|
||||
{
|
||||
// Rien
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user