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