banner
3 weeks ago
bodies
3 weeks ago
check
3 weeks ago
cli
3 weeks ago
cron
3 weeks ago
dashboard
3 weeks ago
database
3 weeks ago
external
3 weeks ago
extracter
3 weeks ago
htaccess
3 weeks ago
notices
3 weeks ago
progress
3 weeks ago
scanner
3 weeks ago
services
3 weeks ago
staging
3 weeks ago
traits
3 weeks ago
uploader
3 weeks ago
vendor
3 weeks ago
zipper
3 weeks ago
.htaccess
3 weeks ago
activation.php
3 weeks ago
ajax.php
3 weeks ago
ajax_offline.php
3 weeks ago
analyst.php
3 weeks ago
backup-process.php
3 weeks ago
class-backup-method-mananger.php
3 weeks ago
cli-handler.php
3 weeks ago
compatibility.php
3 weeks ago
config.php
3 weeks ago
constants.php
3 weeks ago
file-explorer.php
3 weeks ago
initializer.php
3 weeks ago
logger.php
3 weeks ago
offline.php
3 weeks ago
logger.php
47 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 | $configDir = BMI_CONFIG_DIR . DIRECTORY_SEPARATOR . 'complete_logs.' . BMI_LOGS_SUFFIX . '.log'; |
| 17 | if (is_dir(dirname($configDir)) && file_exists($configDir)) { |
| 18 | $date = '[' . date('Y-m-d H:i:s') . '] '; |
| 19 | $file = fopen($configDir, 'a'); |
| 20 | fwrite($file, $date . $type . ' ' . $log . "\n"); |
| 21 | fclose($file); |
| 22 | } |
| 23 | |
| 24 | } |
| 25 | |
| 26 | public static function log($log) { |
| 27 | |
| 28 | BMI_Logger::append('[LOG]', $log); |
| 29 | |
| 30 | } |
| 31 | |
| 32 | public static function error($log) { |
| 33 | |
| 34 | BMI_Logger::append('[ERROR]', $log); |
| 35 | |
| 36 | } |
| 37 | |
| 38 | public static function debug($log) { |
| 39 | |
| 40 | if (BMI_DEBUG === TRUE) { |
| 41 | BMI_Logger::append('[DEBUG]', $log); |
| 42 | } |
| 43 | |
| 44 | } |
| 45 | |
| 46 | } |
| 47 |