banner
2 years ago
check
2 years ago
cli
2 years ago
cron
2 years ago
dashboard
2 years ago
database
2 years ago
extracter
2 years ago
htaccess
2 years ago
progress
2 years ago
scanner
2 years ago
staging
2 years ago
uploader
2 years ago
zipper
2 years ago
activation.php
2 years ago
ajax.php
2 years ago
analyst.php
2 years ago
backup-cli.php
2 years ago
backup-heart.php
2 years ago
bypasser.php
2 years ago
cli-handler.php
2 years ago
compatibility.php
2 years ago
config.php
2 years ago
constants.php
2 years ago
initializer.php
2 years ago
logger.php
2 years ago
restore-batching.php
2 years ago
logger.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | // Namespace |
| 4 | namespace BMI\Plugin; |
| 5 | |
| 6 | // Exit on direct access |
| 7 | if (!defined('ABSPATH')) exit; |
| 8 | |
| 9 | /** |
| 10 | * Main Plugin Logger |
| 11 | */ |
| 12 | class BMI_Logger { |
| 13 | |
| 14 | public static function append($type, $log) { |
| 15 | |
| 16 | if (file_exists(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'complete_logs.log')) { |
| 17 | $date = '[' . date('Y-m-d H:i:s') . '] '; |
| 18 | $file = fopen(BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'complete_logs.log', 'a'); |
| 19 | fwrite($file, $date . $type . ' ' . $log . "\n"); |
| 20 | fclose($file); |
| 21 | } |
| 22 | |
| 23 | } |
| 24 | |
| 25 | public static function log($log) { |
| 26 | |
| 27 | BMI_Logger::append('[LOG]', $log); |
| 28 | |
| 29 | } |
| 30 | |
| 31 | public static function error($log) { |
| 32 | |
| 33 | BMI_Logger::append('[ERROR]', $log); |
| 34 | |
| 35 | } |
| 36 | |
| 37 | public static function debug($log) { |
| 38 | |
| 39 | if (BMI_DEBUG === TRUE) { |
| 40 | BMI_Logger::append('[DEBUG]', $log); |
| 41 | } |
| 42 | |
| 43 | } |
| 44 | |
| 45 | } |
| 46 |