diff --git a/classes/Tools/Storage/Driver/GoogleCloud/GoogleStorage.php b/classes/Tools/Storage/Driver/GoogleCloud/GoogleStorage.php index 1889f7a1..7ed52e0e 100755 --- a/classes/Tools/Storage/Driver/GoogleCloud/GoogleStorage.php +++ b/classes/Tools/Storage/Driver/GoogleCloud/GoogleStorage.php @@ -201,7 +201,7 @@ public function validateSettings($errorCollector = null) { $errorCollector->addError("Bucket {$this->settings->bucket} does not exist."); } - Logger::info("Bucket does not exist.", [], __METHOD__, __LINE__); + Logger::error("Bucket does not exist.", [], __METHOD__, __LINE__); } } catch (\Exception $ex) { if ($errorCollector) { @@ -283,7 +283,7 @@ protected function getClient($errorCollector = null) { $errorCollector->addError("Google configuration is incorrect or missing."); } - Logger::info('Could not create Google storage client.', [], __METHOD__, __LINE__); + Logger::error('Could not create Google storage client.', [], __METHOD__, __LINE__); } return $client; diff --git a/classes/Tools/Storage/Driver/S3/S3Storage.php b/classes/Tools/Storage/Driver/S3/S3Storage.php index dddf9069..3930b993 100755 --- a/classes/Tools/Storage/Driver/S3/S3Storage.php +++ b/classes/Tools/Storage/Driver/S3/S3Storage.php @@ -198,7 +198,7 @@ public function validateSettings($errorCollector = null) { if (empty($valid) && empty($connectError)) { try { - Logger::info("Bucket does not exist, trying to list buckets.", [], __METHOD__, __LINE__); + Logger::warning("Bucket does not exist, trying to list buckets.", [], __METHOD__, __LINE__); $result = $client->listBuckets(); $buckets = $result->get('Buckets'); @@ -216,7 +216,7 @@ public function validateSettings($errorCollector = null) { $errorCollector->addError("Bucket {$this->settings->bucket} does not exist."); } - Logger::info("Bucket does not exist.", [], __METHOD__, __LINE__); + Logger::error("Bucket does not exist.", [], __METHOD__, __LINE__); } } catch(AwsException $ex) { if ($errorCollector) { diff --git a/classes/Tools/Storage/StorageContentHooks.php b/classes/Tools/Storage/StorageContentHooks.php index 60397dc6..b901564b 100755 --- a/classes/Tools/Storage/StorageContentHooks.php +++ b/classes/Tools/Storage/StorageContentHooks.php @@ -237,7 +237,7 @@ public function fixGutenbergFigures($content) { } if (preg_match_all('/())/m', $content, $figures)) { - Logger::info("Found ".count($figures[0])." gutenberg figures."); + Logger::info("Found ".count($figures[0])." gutenberg figures.", [], __METHOD__, __LINE__); foreach($figures[0] as $figureMatch) { if (preg_match('/settings->replaceAllImageUrls)) { @@ -661,14 +661,14 @@ public function filterContent($content, $context = 'post') { ]; } } else { - Logger::info("Unable to map URL to post ID using attachment_url_to_postid(): ".$image, [], __METHOD__, __LINE__); + Logger::warning("Unable to map URL to post ID using attachment_url_to_postid(): ".$image, [], __METHOD__, __LINE__); $this->addToReport(null, 'Image', $matchedUrl, null, 'Unable to map URL to post ID.'); } } else { - Logger::info("Unable to map URL to post ID, no regex match $imageRegex: ".$image, [], __METHOD__, __LINE__); + Logger::warning("Unable to map URL to post ID, no regex match $imageRegex: ".$image, [], __METHOD__, __LINE__); } } else if (!$imageFound) { - Logger::info("Unable to map URL to post ID: ".$image, [], __METHOD__, __LINE__); + Logger::warning("Unable to map URL to post ID: ".$image, [], __METHOD__, __LINE__); $this->addToReport(null, 'Image', $src, null, 'Unable to map URL to post ID.'); } } diff --git a/classes/Tools/Storage/StorageGlobals.php b/classes/Tools/Storage/StorageGlobals.php index 2810e522..c792c585 100755 --- a/classes/Tools/Storage/StorageGlobals.php +++ b/classes/Tools/Storage/StorageGlobals.php @@ -361,7 +361,7 @@ public static function deleteOnUpload() { /** @return bool */ public static function queuedDeletes() { $canQueue = apply_filters('media-cloud/storage/queue-deletes', true); - Logger::info("StorageGlobals::queuedDeletes - Filter returned: '$canQueue'", [], __METHOD__, __LINE__); + Logger::info("Filter returned: '$canQueue'", [], __METHOD__, __LINE__); return (!empty($canQueue) && self::instance()->queuedDeletes); } diff --git a/classes/Tools/Video/Driver/Mux/MuxAPI.php b/classes/Tools/Video/Driver/Mux/MuxAPI.php index 8f552d4a..588b4df3 100755 --- a/classes/Tools/Video/Driver/Mux/MuxAPI.php +++ b/classes/Tools/Video/Driver/Mux/MuxAPI.php @@ -111,20 +111,20 @@ public static function validateSignature($muxSignature, $body, $secret, $toleran } if (empty($time) || empty($signature) || empty($body)) { - Logger::info("Mux: Missing time and/or signature.", [], __METHOD__, __LINE__); + Logger::error("Mux: Missing time and/or signature.", [], __METHOD__, __LINE__); return false; } $expected = hash_hmac('sha256', "{$time}.{$body}", $secret); if ($expected !== $signature) { - Logger::info("Mux: Signature mismatch.", [], __METHOD__, __LINE__); + Logger::error("Mux: Signature mismatch.", [], __METHOD__, __LINE__); return false; } $offset = time() - $time; if ($offset > $tolerance) { - Logger::info("Mux: Signature time tolerance exceeded.", [], __METHOD__, __LINE__); + Logger::error("Mux: Signature time tolerance exceeded.", [], __METHOD__, __LINE__); return false; } @@ -139,7 +139,7 @@ public static function validateSignature($muxSignature, $body, $secret, $toleran */ public static function signingKey() { if (static::keysAPI() === null) { - Logger::info("Mux: Could not create keys API", [], __METHOD__, __LINE__); + Logger::error("Mux: Could not create keys API", [], __METHOD__, __LINE__); return null; } @@ -151,7 +151,7 @@ public static function signingKey() { 'privateKey' => $signingKey['privateKey'] ]; } else { - Logger::info('Mux: Key expired, creating a new one.', [], __METHOD__, __LINE__); + Logger::warning('Mux: Key expired, creating a new one.', [], __METHOD__, __LINE__); } } @@ -159,7 +159,7 @@ public static function signingKey() { $result = static::keysAPI()->createUrlSigningKey(); $muxKey = $result->getData(); if ($muxKey === null) { - Logger::info("Mux: Error creating new signing key.", [], __METHOD__, __LINE__); + Logger::error("Mux: Error creating new signing key.", [], __METHOD__, __LINE__); return null; } @@ -182,7 +182,7 @@ public static function signingKey() { 'privateKey' => $signingKey['privateKey'] ]; } catch (ApiException $ex) { - Logger::info("Mux: Error creating signing key: ".$ex->getMessage(), [], __METHOD__, __LINE__); + Logger::error("Mux: Error creating signing key: ".$ex->getMessage(), [], __METHOD__, __LINE__); } return null; diff --git a/classes/Tools/Video/Driver/Mux/MuxHooks.php b/classes/Tools/Video/Driver/Mux/MuxHooks.php index 60262915..efae14e8 100755 --- a/classes/Tools/Video/Driver/Mux/MuxHooks.php +++ b/classes/Tools/Video/Driver/Mux/MuxHooks.php @@ -101,7 +101,7 @@ protected function updateAttachmentMeta( $asset ) { if ( empty($asset->attachmentId) ) { - Logger::info( + Logger::error( "Mux: Missing attachment id, cannot update meta.", [], __METHOD__, @@ -119,7 +119,7 @@ protected function updateAttachmentMeta( $asset ) $meta = get_post_meta( $asset->attachmentId, '_wp_attachment_metadata', true ); if ( empty($meta) ) { - Logger::info( + Logger::error( "Mux: Attachment {$asset->attachmentId} meta is missing or empty, cannot update.", [], __METHOD__, @@ -156,7 +156,7 @@ protected function createAttachmentForAsset( $asset ) ); if ( MuxAPI::assetAPI() === null ) { - Logger::info( + Logger::error( "Mux: Unable to create API client", [], __METHOD__, @@ -169,7 +169,7 @@ protected function createAttachmentForAsset( $asset ) $result = MuxAPI::assetAPI()->getAssetInputInfo( $asset->muxId ); if ( $result === null ) { - Logger::info( + Logger::error( "Mux: Could not get asset input info for {$asset->muxId}", [], __METHOD__, @@ -179,7 +179,7 @@ protected function createAttachmentForAsset( $asset ) } } catch ( \Exception $ex ) { - Logger::info( + Logger::error( "Mux: Mux error fetching input info: " . $ex->getMessage(), [], __METHOD__, @@ -190,7 +190,7 @@ protected function createAttachmentForAsset( $asset ) $inputInfos = $result->getData(); if ( empty($inputInfos) ) { - Logger::info( + Logger::error( "Mux: Could not find asset inputs for {$asset->muxId}", [], __METHOD__, @@ -255,7 +255,7 @@ protected function assignThumbnailForAsset( $asset ) } if ( has_post_thumbnail( $asset->attachmentId ) ) { - Logger::info( + Logger::warning( "Mux: Thumbnail already exists", [], __METHOD__, @@ -268,7 +268,7 @@ protected function assignThumbnailForAsset( $asset ) $url = $asset->thumbnailUrl(); if ( empty($url) ) { - Logger::info( + Logger::error( "Mux: Could not generate URL for thumbnail?", [], __METHOD__, @@ -292,7 +292,7 @@ protected function assignThumbnailForAsset( $asset ) file_put_contents( $filePath, ilab_file_get_contents( $url ) ); if ( !file_exists( $filePath ) ) { - Logger::info( + Logger::error( "Mux: Could not download image {$url}.", [], __METHOD__, @@ -516,7 +516,7 @@ public function handleWebhook( $template ) if ( strpos( $_SERVER['REQUEST_URI'], '/__mux/webhook' ) === 0 ) { if ( !isset( $_SERVER['HTTP_MUX_SIGNATURE'] ) ) { - Logger::info( + Logger::error( "Mux: Missing Mux Signature", [], __METHOD__, @@ -530,7 +530,7 @@ public function handleWebhook( $template ) $body = file_get_contents( 'php://input' ); if ( !MuxAPI::validateSignature( $_SERVER['HTTP_MUX_SIGNATURE'], $body, $this->settings->webhookSecret ) ) { - Logger::info( + Logger::error( "Mux: Invalid Mux Signature", [], __METHOD__, @@ -544,7 +544,7 @@ public function handleWebhook( $template ) $data = json_decode( $body, true ); $type = arrayPath( $data, 'type', null ); if ( empty($type) ) { - Logger::info( + Logger::error( "Mux: Webhook missing type. Exiting.", [], __METHOD__, diff --git a/classes/Tools/Video/Driver/Mux/MuxTool.php b/classes/Tools/Video/Driver/Mux/MuxTool.php index 1ffec1fe..16b070f9 100755 --- a/classes/Tools/Video/Driver/Mux/MuxTool.php +++ b/classes/Tools/Video/Driver/Mux/MuxTool.php @@ -484,7 +484,7 @@ public function prepareAttachmentForJS( $response, $attachment, $meta ) $mux['src'] = $asset->videoUrl( false ); $mux['gif'] = $asset->gifUrl( false ); } catch ( \Exception $ex ) { - Logger::info( + Logger::error( "Mux: Exception fetching Mux Asset {$mux['muxId']}: " . $ex->getMessage(), [], __METHOD__, @@ -514,7 +514,7 @@ public function deleteAttachment( $id ) try { MuxAPI::assetAPI()->deleteAsset( $muxId ); } catch ( \Exception $ex ) { - Logger::info( + Logger::error( 'Mux: Error deleting asset from Mux: ' . $ex->getMessage(), [], __METHOD__, diff --git a/classes/Utilities/Helpers.php b/classes/Utilities/Helpers.php index f4a76c9d..596fe702 100755 --- a/classes/Utilities/Helpers.php +++ b/classes/Utilities/Helpers.php @@ -259,7 +259,7 @@ function phpMemoryLimit($default = '64M') { if (function_exists('ini_get')) { $memory_limit = ini_get('memory_limit'); } else { - Logger::info("ini_get disabled is disabled, unable to determine real memory limit", [], __FUNCTION__, __LINE__); + Logger::warning("ini_get disabled is disabled, unable to determine real memory limit", [], __FUNCTION__, __LINE__); } if (empty($memory_limit) || ($memory_limit == -1)) { diff --git a/classes/Utilities/Logging/DatabaseLogTable.php b/classes/Utilities/Logging/DatabaseLogTable.php index 5b80fed3..fc751c75 100755 --- a/classes/Utilities/Logging/DatabaseLogTable.php +++ b/classes/Utilities/Logging/DatabaseLogTable.php @@ -14,6 +14,8 @@ namespace MediaCloud\Plugin\Utilities\Logging; +use MediaCloud\Plugin\Utilities\View; + class DatabaseLogTable extends \WP_List_Table { /** @var null|DatabaseLogger Logger */ private $logger = null; @@ -35,7 +37,10 @@ public function no_items() { public function get_columns() { return [ 'date' => 'Date', - 'level' => 'Level', + 'level' => 'Level', + 'class' => 'Class', + 'method' => 'Method', + 'line' => 'Line', 'message' => 'Message', 'context' => 'Context' ]; @@ -54,20 +59,32 @@ public function process_bulk_action() { } public function prepare_items() { + $logLevel = (!empty($_REQUEST['level'])) ? $_REQUEST['level'] : null; + $class = (!empty($_REQUEST['class'])) ? $_REQUEST['class'] : null; + $search = (!empty($_REQUEST['message'])) ? $_REQUEST['message'] : null; + $columns = $this->get_columns(); $this->_column_headers = array($columns, [], []); - $perPage = $this->get_items_per_page('log_entries_per_page', 60); + $perPage = $this->get_items_per_page('log_entries_per_page', 120); $currentPage = $this->get_pagenum(); $this->set_pagination_args([ - 'total_items' => $this->logger->totalEntries(), + 'total_items' => $this->logger->totalEntries($logLevel, $class, $search), 'per_page' => $perPage ]); - $this->items = $this->logger->getLogEntries($perPage, $currentPage); + $this->items = $this->logger->getLogEntries($logLevel, $class, $search, $perPage, $currentPage); } + protected function get_table_classes() { + $mode = get_user_setting( 'posts_list_mode', 'list' ); + + $mode_class = esc_attr( 'table-view-' . $mode ); + + return array('mediacloud-table', 'widefat', 'striped', $mode_class, $this->_args['plural'] ); + } + public function column_date($item) { return ''.date('n/j/Y g:i a',strtotime($item['date'])).''; } @@ -77,27 +94,42 @@ public function column_level($item) { } public function column_message($item) { - return $item['message']; + return esc_html($item['message']); } - public function column_context($item) { - return $item['context']; - } + public function column_context($item) { + return esc_html($item['context']); + } + + public function column_class($item) { + return '
'.$item['class'].'
'; + } + + public function column_method($item) { + return ''.$item['method'].''; + } + + public function column_line($item) { + return ''.$item['line'].''; + } public function extra_tablenav($which) { parent::extra_tablenav($which); // TODO: Change the autogenerated stub if ($which == 'top') { - echo "
"; - echo "
"; - echo " "; - echo "
"; - echo " "; - echo " "; - echo " "; - echo "
"; - echo "
"; + echo View::render_view('debug.log-filter', [ + 'classes' => $this->logger->getClasses() + ]); +// echo "
"; +// echo "
"; +// echo " "; +// echo "
"; +// echo " "; +// echo " "; +// echo " "; +// echo "
"; +// echo "
"; } } } \ No newline at end of file diff --git a/classes/Utilities/Logging/DatabaseLogger.php b/classes/Utilities/Logging/DatabaseLogger.php index 3ba49a65..ae3ae146 100755 --- a/classes/Utilities/Logging/DatabaseLogger.php +++ b/classes/Utilities/Logging/DatabaseLogger.php @@ -23,6 +23,8 @@ * @package MediaCloud\Plugin\Utilities */ class DatabaseLogger { + const DB_VERSION = '1.0.5'; + /** @var bool */ private $enabled = false; @@ -51,8 +53,11 @@ public function __construct() { * @param $level * @param $message * @param $context + * @param $class + * @param $method + * @param $line */ - public function log($channel, $level, $message, $context = '') { + public function log($channel, $level, $message, $context = '', $class = null, $method = null, $line = null) { if (!$this->enabled) { return; } @@ -61,7 +66,7 @@ public function log($channel, $level, $message, $context = '') { global $wpdb; - $query = $wpdb->prepare("insert into {$this->table} (date, channel, level, message, context) values (%s, %s, %s, %s, %s)", current_time('mysql', true), $channel, $level, $message, $context); + $query = $wpdb->prepare("insert into {$this->table} (date, channel, level, message, context, class, method, line) values (%s, %s, %s, %s, %s, %s, %s, %d)", current_time('mysql', true), $channel, $level, $message, $context, $class, $method, $line); $wpdb->query($query); } //endregion @@ -72,33 +77,39 @@ public function log($channel, $level, $message, $context = '') { * Insures the table exists */ protected function insureTable() { - global $wpdb; - - $this->table = $wpdb->base_prefix.'ilab_mc_logging'; - - $tableSchema = <<table} ( - id bigint not null auto_increment, - date datetime not null, - channel varchar(32) not null, - level varchar(16) not null, - message text, - context text, - primary key(id) - ); -SQL; - - global $wpdb; - - $query = $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($this->table)); - - $this->enabled = ($wpdb->get_var($query) == $this->table); - - if (!$this->enabled) { - $wpdb->query($tableSchema); - - $this->enabled = ($wpdb->get_var($query) == $this->table); - } + global $wpdb; + $this->table = $wpdb->base_prefix.'ilab_mc_logging'; + + $currentVersion = get_site_option('mcloud_logging_table_db_version'); + if (!empty($currentVersion) && version_compare(self::DB_VERSION, $currentVersion, '<=')) { + $this->enabled = true; + return; + } + + $charset = $wpdb->get_charset_collate(); + + $tableSchema = "CREATE TABLE {$this->table} ( + id BIGINT AUTO_INCREMENT, + date DATETIME NOT NULL, + class VARCHAR(128), + method VARCHAR(128), + channel VARCHAR(32) NOT NULL, + level VARCHAR(16) NOT NULL, + message TEXT NULL, + context TEXT NULL, + line BIGINT NULL, + PRIMARY KEY (id) +) {$charset};"; + + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); + $result = dbDelta($tableSchema); + + $exists = ($wpdb->get_var("SHOW TABLES LIKE '$this->table'") == $this->table); + if ($exists) { + update_site_option('mcloud_logging_table_db_version', self::DB_VERSION); + } + + $this->enabled = $exists; } /** @@ -141,9 +152,9 @@ public function csv() { global $wpdb; $fd = fopen('php://temp/maxmemory:1048576', 'w'); - fputcsv($fd, ["date", "channel", "level", "message", "context"]); + fputcsv($fd, ["date", "channel", "level", "class", "method", "line", "message", "context"]); - $rows = $wpdb->get_results("select date, channel, level, message, context from {$this->table} order by id asc", ARRAY_N); + $rows = $wpdb->get_results("select date, channel, level, class, method, line, message, context from {$this->table} order by id asc", ARRAY_N); if (is_array($rows) && count($rows) > 0) { foreach($rows as $row) { @@ -162,17 +173,63 @@ public function csv() { // region Querying - public function getLogEntries($perPage = 50, $pageNumber = 1) { + public function getLogEntries($logLevel = null, $class = null, $search = null, $perPage = 50, $pageNumber = 1) { global $wpdb; $offset = ($pageNumber - 1) * $perPage; - $query = "select * from {$this->table} order by id desc limit $perPage offset $offset"; + $where = $this->buildWhere($logLevel, $class, $search); + $query = "select * from {$this->table} {$where} order by id desc limit $perPage offset $offset"; return $wpdb->get_results($query, ARRAY_A); } - public function totalEntries() { + private function buildWhere($logLevel, $class, $search) { + $where = []; + $whereVals = []; + + if (!empty($logLevel)) { + $where[] = 'level = %s'; + $whereVals[] = $logLevel; + } + + if (!empty($class)) { + if ($class === 'not-empty') { + $where[] = 'class is not null and class != \'\''; + } else if ($class === 'empty') { + $where[] = 'class is null or class = \'\''; + } else { + $where[] = 'class = %s'; + $whereVals[] = $class; + } + } + + if (!empty($search)) { + $where[] = 'message like %s'; + $whereVals[] = '%'.$search.'%'; + } + + if (count($where) > 0) { + if (count($whereVals) > 0) { + $whereClause = ' where '.implode(' and ', $where); + + global $wpdb; + return $wpdb->prepare($whereClause, $whereVals); + } else { + return ' where '.implode(' and ', $where); + } + } + + return ''; + } + + public function totalEntries($logLevel = null, $class = null, $search = null) { global $wpdb; - return $wpdb->get_var("select count(id) from {$this->table}"); + return $wpdb->get_var("select count(id) from {$this->table}".$this->buildWhere($logLevel, $class, $search)); + } + + public function getClasses() { + global $wpdb; + $query = "select distinct class from {$this->table} where class is not null and class != '' order by class asc"; + return $wpdb->get_results($query, ARRAY_A); } // endregion diff --git a/classes/Utilities/Logging/DatabaseLoggerHandler.php b/classes/Utilities/Logging/DatabaseLoggerHandler.php index 37711ff5..cb0da86d 100755 --- a/classes/Utilities/Logging/DatabaseLoggerHandler.php +++ b/classes/Utilities/Logging/DatabaseLoggerHandler.php @@ -33,9 +33,24 @@ public function __construct($level = 100, $bubble = true) { */ protected function write(array $record) { $context = ''; + $class = null; + $method = null; + $line = null; if (isset($record['context']) && is_array($record['context']) && (count($record['context']) > 0)) { $flattenedContext = []; foreach($record['context'] as $key => $value) { + if (in_array($key, ['__class', '__method', '__line'])) { + if ($key === '__class') { + $class = $value; + } else if ($key === '__method') { + $method = $value; + } else if ($key === '__line') { + $line = $value; + } + + continue; + } + if (is_array($value)) { continue; } @@ -50,6 +65,6 @@ protected function write(array $record) { $context = implode(", ", $flattenedContext); } - $this->logger->log($record['channel'], $record['level_name'], $record['message'], $context); + $this->logger->log($record['channel'], $record['level_name'], $record['message'], $context, $class, $method, $line); } } \ No newline at end of file diff --git a/classes/Utilities/Logging/Logger.php b/classes/Utilities/Logging/Logger.php index c474d4d9..8f407a95 100755 --- a/classes/Utilities/Logging/Logger.php +++ b/classes/Utilities/Logging/Logger.php @@ -180,16 +180,25 @@ protected function logSystemError($type, $message, $file, $line) { } } - private function prepMessage($message, $function = null, $line = null) { + private function prepMessage($message, $function = null, $line = null, &$context) { if (!empty($function)) { - if (!empty($line)) { - $message = ':'.$line.' '.$message; - } $functionParts = explode('\\', $function); $function = array_pop($functionParts); + $functionParts = explode('::', $function); + $prefix = $function; + if (count($functionParts) > 1) { + $context['__class'] = array_shift($functionParts); + $context['__method'] = array_shift($functionParts); + $context['__line'] = intval($line); + $prefix = ''; + } else { + if (!empty($line)) { + $prefix = $prefix.':'.$line.' '; + } + } - $message = $function.$message.(empty($line) ? '' : ' '); + $message = $prefix.$message; } $pid = @getmypid(); @@ -206,7 +215,7 @@ protected function doLogInfo($message, $context=[], $function = null, $line = nu } if ($this->logger) { - $message = $this->prepMessage($message, $function, $line); + $message = $this->prepMessage($message, $function, $line, $context); $this->logger->addInfo($message, array_merge($this->context, $context)); } } @@ -217,7 +226,7 @@ protected function doLogWarning($message, $context=[], $function = null, $line = } if ($this->logger) { - $message = $this->prepMessage($message, $function, $line); + $message = $this->prepMessage($message, $function, $line, $context); $this->logger->addWarning($message, array_merge($this->context, $context)); } } @@ -228,7 +237,7 @@ protected function doLogError($message, $context=[], $function = null, $line = n } if ($this->logger) { - $message = $this->prepMessage($message, $function, $line); + $message = $this->prepMessage($message, $function, $line, $context); $this->logger->addError($message, array_merge($this->context, $context)); } } @@ -236,7 +245,7 @@ protected function doLogError($message, $context=[], $function = null, $line = n protected function doStartTiming($message, $context=[], $function = null, $line = null) { if ($this->logger) { $this->time[] = microtime(true); - $message = $this->prepMessage($message, $function, $line); + $message = $this->prepMessage($message, $function, $line, $context); $this->logger->addInfo($message, array_merge($this->context, $context)); } } @@ -245,7 +254,7 @@ protected function doEndTiming($message, $context=[], $function = null, $line = if ($this->logger) { $time = array_pop($this->time); $context['time'] = microtime(true) - $time; - $message = $this->prepMessage($message, $function, $line); + $message = $this->prepMessage($message, $function, $line, $context); $this->logger->addInfo($message, array_merge($this->context, $context)); } } diff --git a/ilab-media-tools.php b/ilab-media-tools.php index 723dd822..69af048a 100755 --- a/ilab-media-tools.php +++ b/ilab-media-tools.php @@ -5,7 +5,7 @@ Plugin URI: https://github.com/interfacelab/ilab-media-tools Description: Automatically upload media to Amazon S3 and integrate with Imgix, a real-time image processing CDN. Boosts site performance and simplifies workflows. Author: interfacelab -Version: 4.2.10 +Version: 4.2.11 Author URI: http://interfacelab.io */ // Copyright (c) 2016 Interfacelab LLC. All rights reserved. @@ -94,7 +94,7 @@ } // Version Defines -define( 'MEDIA_CLOUD_VERSION', '4.2.10' ); +define( 'MEDIA_CLOUD_VERSION', '4.2.11' ); define( 'MEDIA_CLOUD_INFO_VERSION', '4.0.2' ); define( 'MCLOUD_IS_BETA', false ); // Directory defines diff --git a/readme.txt b/readme.txt index 099d0f90..df38ee33 100755 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Requires at least: 4.9 Tested up to: 5.7 License: GPLv3 or later License URI: http://www.gnu.org/licenses/gpl-3.0.html -Stable tag: 4.2.10 +Stable tag: 4.2.11 Requires PHP: 7.1 Automatically store media on Amazon S3, Google Cloud Storage, DigitalOcean Spaces + others. Serve CSS/JS assets through CDNs. Integrate with Imgix. @@ -105,6 +105,12 @@ Imgix is a content delivery network with a twist. In addition to distributing y == Changelog == += 4.2.11 = + +* Fix for Elementor Update task on unicode/utf-8 pages. +* Debug log can now be filtered and searched +* Insure logging is using appropriate logging levels + = 4.2.10 = * Added test to system check to insure that required database tables are installed. diff --git a/views/debug/log-filter.blade.php b/views/debug/log-filter.blade.php new file mode 100755 index 00000000..b079586b --- /dev/null +++ b/views/debug/log-filter.blade.php @@ -0,0 +1,30 @@ +
+
+
+
+
|
+
+ + @if(isset($_REQUEST['paged'])) + + @endif + + + + +
+
\ No newline at end of file diff --git a/views/debug/log-viewer.blade.php b/views/debug/log-viewer.blade.php index a42c3c1c..67392140 100755 --- a/views/debug/log-viewer.blade.php +++ b/views/debug/log-viewer.blade.php @@ -34,17 +34,37 @@ } .column-channel { - width: 140px !important; + /*width: 140px !important;*/ } .column-date { - width: 140px !important; + /*width: 140px !important;*/ } .column-level { - width: 60px !important; + /*width: 60px !important;*/ white-space: nowrap; } + + .column-class { + /*width: 160px !important;*/ + white-space: nowrap; + } + + .column-method { + /*width: 160px !important;*/ + white-space: nowrap; + } + + .column-line { + /*width: 60px !important;*/ + white-space: nowrap; + } + + .column-message { + /*max-width: 100%;*/ + width: 100% !important; + } @endsection