Action_Logger.php
2 weeks ago
Admin.php
2 weeks ago
Canonical_Formatter.php
2 weeks ago
File_Logger.php
2 weeks ago
Logger.php
2 weeks ago
Monolog_Logger.php
2 weeks ago
Null_Logger.php
2 weeks ago
Service_Provider.php
2 weeks ago
Null_Logger.php
107 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | /** |
| 5 | * Class Null_Logger |
| 6 | * |
| 7 | * Logs nothing, reads nothing. |
| 8 | */ |
| 9 | class Tribe__Log__Null_Logger implements Tribe__Log__Logger { |
| 10 | |
| 11 | /** |
| 12 | * Indicates if the logger will work in the current environment. |
| 13 | * |
| 14 | * @return bool |
| 15 | */ |
| 16 | public function is_available() { |
| 17 | return true; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Returns a 'human friendly' name for the logging implementation. |
| 22 | * |
| 23 | * @return string |
| 24 | */ |
| 25 | public function get_name() { |
| 26 | return __( 'Null logger (will log nothing)', 'tribe-common' ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Responsible for commiting the entry to the log (but only if the debug level |
| 31 | * is appropriate). |
| 32 | * |
| 33 | * @param string $entry |
| 34 | * @param string $type |
| 35 | * @param string $src |
| 36 | */ |
| 37 | public function log( $entry, $type = Tribe__Log::DEBUG, $src = '' ) { |
| 38 | // no-op |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Retrieve up to $limit most recent log entries in reverse chronological |
| 43 | * order. If $limit is a negative or zero value, there is no limit. |
| 44 | * |
| 45 | * Implementation-specific arguments can optionally be provided as a second |
| 46 | * parameter. This may include support for a 'log' param where an identifer |
| 47 | * obtained via the list_availalbe_logs() method is passed in order to query |
| 48 | * a specific archived log. |
| 49 | * |
| 50 | * @see Tribe__Log__Logger::list_available_logs() |
| 51 | * |
| 52 | * @param int $limit |
| 53 | * @param array $args |
| 54 | * |
| 55 | * @return array |
| 56 | */ |
| 57 | public function retrieve( $limit = 0, array $args = [] ) { |
| 58 | return []; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Returns a list of currently accessible logs (current first, oldest last). |
| 63 | * |
| 64 | * This can be useful if, for instance, a particular logger organizes logging |
| 65 | * by dates and keeps an archive of upto 1 week's worth of logs - in which case |
| 66 | * the array might look like: |
| 67 | * |
| 68 | * [ '2016-12-31', |
| 69 | * '2016-12-30', |
| 70 | * '2016-12-30', |
| 71 | * '2016-12-30', |
| 72 | * '2016-12-30', ... ] |
| 73 | * |
| 74 | * Note that a) the array may be empty and b) it won't necessarily contain |
| 75 | * date strings, it could contain identifiers like 'current', 'prev', 'prev2' |
| 76 | * or really anything the logging engine prefers. |
| 77 | * |
| 78 | * @return array |
| 79 | */ |
| 80 | public function list_available_logs() { |
| 81 | return []; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Switches to the specified log. |
| 86 | * |
| 87 | * If optional param $create is true the logger will try to create a new log |
| 88 | * using the provided identifier if it doesn't already exist. |
| 89 | * |
| 90 | * @param mixed $log_identifier |
| 91 | * @param bool $create |
| 92 | * |
| 93 | * @return bool |
| 94 | */ |
| 95 | public function use_log( $log_identifier, $create = false ) { |
| 96 | // no-op |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Performs routine maintenance and cleanup work (such as log rotation) |
| 101 | * whenever it is called. |
| 102 | */ |
| 103 | public function cleanup() { |
| 104 | // no-op |
| 105 | } |
| 106 | } |
| 107 |