| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) die('No direct access allowed'); |
| 4 |
|
| 5 |
if (class_exists('Updraft_Log_Levels')) return; |
| 6 |
|
| 7 |
/** |
| 8 |
* Class Updraft_Log_Levels |
| 9 |
*/ |
| 10 |
class Updraft_Log_Levels { |
| 11 |
|
| 12 |
const EMERGENCY = 'emergency'; |
| 13 |
const ALERT = 'alert'; |
| 14 |
const CRITICAL = 'critical'; |
| 15 |
const ERROR = 'error'; |
| 16 |
const WARNING = 'warning'; |
| 17 |
const NOTICE = 'notice'; |
| 18 |
const INFO = 'info'; |
| 19 |
const DEBUG = 'debug'; |
| 20 |
|
| 21 |
/** |
| 22 |
* Return level text catption |
| 23 |
* |
| 24 |
* @param string $level Text of level Type. |
| 25 |
* @return string Returns the Level type. |
| 26 |
*/ |
| 27 |
static public function to_text($level) { |
| 28 |
|
| 29 |
$text = array( |
| 30 |
self::EMERGENCY => 'EMERGENCY', |
| 31 |
self::ALERT => 'ALERT', |
| 32 |
self::CRITICAL => 'CRITICAL', |
| 33 |
self::ERROR => 'ERROR', |
| 34 |
self::WARNING => 'WARNING', |
| 35 |
self::NOTICE => 'NOTICE', |
| 36 |
self::INFO => 'INFO', |
| 37 |
self::DEBUG => 'DEBUG', |
| 38 |
); |
| 39 |
|
| 40 |
if (array_key_exists($level, $text)) return $text[$level]; |
| 41 |
|
| 42 |
return ''; |
| 43 |
} |
| 44 |
} |
| 45 |
|