installed plugin WP-Matomo Integration
version 1.0.27
This commit is contained in:
47
wp-content/plugins/wp-piwik/classes/WP_Piwik/Logger.php
Normal file
47
wp-content/plugins/wp-piwik/classes/WP_Piwik/Logger.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace WP_Piwik;
|
||||
|
||||
abstract class Logger {
|
||||
|
||||
private $loggerName = 'unnamed';
|
||||
private $loggerContent = array();
|
||||
private $startMicrotime = null;
|
||||
|
||||
abstract function loggerOutput($loggerTime, $loggerMessage);
|
||||
|
||||
public function __construct($loggerName) {
|
||||
$this->setName($loggerName);
|
||||
$this->setStartMicrotime(microtime(true));
|
||||
$this->log('Logging started -------------------------------');
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
$this->log('Logging finished ------------------------------');
|
||||
}
|
||||
|
||||
public function log($loggerMessage) {
|
||||
$this->loggerOutput($this->getElapsedMicrotime(), $loggerMessage);
|
||||
}
|
||||
|
||||
private function setName($loggerName) {
|
||||
$this->loggerName = $loggerName;
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->loggerName;
|
||||
}
|
||||
|
||||
private function setStartMicrotime($startMicrotime) {
|
||||
$this->startMicrotime = $startMicrotime;
|
||||
}
|
||||
|
||||
public function getStartMicrotime() {
|
||||
return $this->startMicrotime;
|
||||
}
|
||||
|
||||
public function getElapsedMicrotime() {
|
||||
return microtime(true) - $this->getStartMicrotime();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user