time(), 'l' => in_array( $level, array( 'info', 'warning', 'error' ), true ) ? $level : 'info', 'm' => mb_substr( wp_strip_all_tags( (string) $message ), 0, 500 ), ); if ( count( $log ) > self::MAX ) { $log = array_slice( $log, -self::MAX ); } update_option( self::OPTION, $log, false ); } /** * Most recent entries, newest first. * * @param int $limit Limit. * @return array */ public static function recent( $limit = 50 ) { $log = get_option( self::OPTION, array() ); if ( ! is_array( $log ) ) { return array(); } return array_slice( array_reverse( $log ), 0, $limit ); } }