diff --git a/.rubocop.yml b/.rubocop.yml index 1ff05e0..862f3c7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -8,3 +8,5 @@ AllCops: - 'client-app/**/*' Discourse/Plugins/NamespaceConstants: Enabled: false +Layout/SpaceAroundKeyword: + Enabled: false diff --git a/CHANGELOG.md b/CHANGELOG.md index af1497c..4068526 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,156 +1,123 @@ # CHANGELOG -- 2025-02-06: 2.20.1 +- 2026-04-29: 2.21.0 + - FEATURE: Allow editing grouping pattern before submitting +- 2025-02-06: 2.20.1 - FIX: Don't break search when providing invalid regex characters - 2024-07-05: 2.20.0 - - Dropped support for Ruby 3.0 - Add `Logster::Logger#subscribe` which allows subscribing to log events from `Logster::Logger`. - 2024-03-12: 2.19.1 - - FIX: Don’t truncate backtrace on copying - 2024-02-28: 2.19.0 - - FIX: Add compatibility with Rails 7.1+ - 2024-02-19: 2.18.1 - - UX: backlink in dark mode has a dark background - 2024-02-15: 2.18.0 - - FEATURE: Implement a default Content-Security-Policy - 2024-02-15: 2.17.1 - - UX: fixed top menu when backlink to the site exists - 2024-02-15: 2.17.0 - - FEATURE: backlink to site - 2024-01-19: 2.16.0 - - FEATURE: Add inline grouping pattern creation - 2024-01-16: 2.15.0 - - FEATURE: Add loading spinner - 2024-01-15: 2.14.0 - - FEATURE: Stop grouping logs with different messages - 2023-11-01: 2.13.1 - - FIX: Solve/remove buttons on 'share' page - 2023-10-03: 2.13.0 - - FEATURE: Format messages with Logster::Logger#formatter before storing - 2023-03-10: 2.12.2 - - FIX: Don't throw on non-gem backtrace lines - 2023-03-10: 2.12.1 Note: 2.12.0 was yanked due to a release process error - - DEV: Upgrade to Ember 3.28 - 2023-01-30: 2.11.4 - - DEV: Various dependencies upgrade - FIX: Switch the `/messages.json` endpoint from `GET` to `POST` - 2022-08-25: 2.11.3 - - DEV: Avoid deprecation warning in Redis 4.8 (#166) - 2022-04-28: 2.11.2 - - FIX: store override level in thread local storage (Truffle Ruby compatibility) - 2022-04-21: 2.11.1 - - FIX: Redis pipelining deprecation (#159) - 2022-03-12: 2.11.0 - - FEATURE: Improve support for logging error objects (#153) - 2021-11-26: 2.10.1 - - UX: More dark-mode related changes - 2021-11-26: 2.10.0 - - FEATURE: Introduce dark mode - 2021-10-27: 2.9.8 - - FIX: We weren't properly memoizing the hostname - 2021-07-01: 2.9.7 - - FEATURE: Optionally use full hostname - 2021-02-19: 2.9.6 - - UX: Make `Warn` level visible by default - 2021-01-21: 2.9.5 - - FIX: Stop encoding errors when converting Message objects to JSON (#128) - DEV: Bump dependencies - 2020-09-01: 2.9.4 - - FEATURE: Merge messages differing only by numbers (#118) - DEV: Bump dependencies - UX: Turn severities below `Error` off by default and remember changes using localStorage (#125) - 2020-08-20: 2.9.3 - - FIX: fix code that causes warning from recent redis gem - 2020-08-11: 2.9.2 - - FIX: `report_js_error` incorrectly denying logs when Redis#exists returns integer - 2020-07-20: 2.9.1 - - FIX: Missing application backtrace in chained loggers. - 2020-06-11: 2.9.0 - - FEATURE: Allows JS errors to specify a log severity - DEV: Several dependencies upgrades - FIX: Don't search if the phrase hasn't changed - UX: Distinguish the value of the current env from the values of other envs in a merged message - 2020-03-30: 2.8.0 - - FEATURE: Upgrade icons to Font Awesome 5 - 2020-03-03: 2.7.1 - - FIX: Stop env mutation to allow all chained loggers to have the same env (#110) - 2020-02-26: 2.7.0 - - FEATURE: Make log message max length configurable and bump the default to 2000 (#109) - 2020-02-17: 2.6.3 - - FIX: Respect redis namespace when fetching env using LUA - 2020-02-09: 2.6.2 - - FIX: Regression with rendering single env when `env_expandable_keys` config is present - DEV: Fix Ember deprecations in tests - DEV: Add more tests to env rendering @@ -159,11 +126,9 @@ - FIX: Fetch env when navigating through grouped messages - 2020-02-07: 2.6.1 - - FIX: Fetch env when row is selected to allow copy to work on Firefox - 2020-02-07: 2.6.0 - - DEV: Bump handlebars from 4.1.2 to 4.5.3 in /client-app (#102) - FEATURE: Linkify backtrace lines to github (#104) - UX: Keep the 50 most recent envs rather than the first 50 (#103). Also introduces new config options `max_env_bytes` and `max_env_count_per_message`. @@ -172,7 +137,6 @@ - DEV: Upgrade Ember to 3.15 and remove jQuery and lodash as dependencies (#107) - 2019-12-13: 2.5.1 - - DEV: Bump puma from 4.2.1 to 4.3.1 in /website (#100) - FIX: Don't include messages that were removed from groups due to max size limit - FIX: loadingEnv is an attribute of model @@ -180,7 +144,6 @@ - UX: Group count attribute should be a long-running number of errors, not just the number of errors the group currently contains - 2019-12-12: 2.5.0 - - DEV: Update to latest version of gems - FIX: when rate limiting return an object responding to each - FEATURE: Expose the search phrase in query params @@ -188,11 +151,9 @@ - FEATURE: Custom grouping patterns - 2019-10-28: 2.4.2 - - FIX: wrong number of arguments when adding message using a block (#98) - 2019-10-17: 2.4.1 - - PERF: Debounce search field so it doesn't fire a search query at every keystroke. - PERF: Disallow search terms that are fewer than 2 characters long. - PERF: Bypass refresh cycle if previous cycle hasn't finished. @@ -200,63 +161,50 @@ - PERF: Cap message size to 60,000 bytes by default. - 2019-10-10: 2.4.0 - - FEATURE: Allow having retroactive affect when adding suppression patterns - DEV: Bump JS dependencies - 2019-10-08: 2.3.3 - - FEATURE: keep track of message timestamp when it's merged into another message - 2019-08-20: 2.3.2 - - FEATURE: automatic 1 minute rate limiting for js error reporting per IP - 2019-08-15: 2.3.1 - - DEV: upgrade Ember to 3.8 and jQuery to 3.4.1 (#84) - FIX: properly escape string ignore pattern (#88) - FIX: scrub params if they have invalid encoding (#92) - 2019-03-26: 2.3.0 - - FEATURE: track count of suppressed logs for each pattern - 2019-03-19: 2.2.0 - - FEATURE: custom suppression patterns via UI - UX: auto expand env keys when list length is <= 3 - 2019-03-14: Unreleased - - FIX: Logster message options missing when base logger is a sub-class of `Logster::Logger` - 2019-02-21: Version 2.1.2 - - FEATURE: allow certain env keys to be expandable via `Logster.config.env_expandable_keys.push(:key, :another_key)`. See https://github.com/discourse/logster/pull/81 for more info - 2019-02-21: Version 2.1.1 - - FEATURE: allow defer logger to be disabled as Ruby 2.5.3 can segfault with defer logger due to a bug in Ruby. To disable run `Logster::Scheduler.disable` - 2019-02-13: Version 2.1.0 - - FEATURE/DEV: adds a defer logger that will do logging asynchronously only in dev environments. It should speed things up a little in dev. - 2019-02-05: Version 2.0.1 - - FIX: env line height issue on iOS - 2019-01-17: Version 2.0.0.pre - - FIX: don't merge any new env samples if there are 50 samples (1.4.0.pre regression) - UX: make env navigation controls stick to the top when scrolled - PERF: store env samples separately from the rest of message data - DEV: Rubocop - 2019-01-09: Version 1.4.0.pre - - FEATURE: allow navigation through merged errors - FEATURE: search should look at env - FIX: deselect message if new filtering doesn't include selected message @@ -264,85 +212,67 @@ - FIX: hide "load more" when there are no more messages and filters/search applied - 2018-12-30: Version 1.3.4 - - FIX: linear-gradient issue on iOS - FIX: actions menu should have highest z-index - 2018-12-26: Version 1.3.3 - - Fix: fix double lines logs when date is too long - 2018-12-25: Version 1.3.2 - - UX: improve usability on mobile - 2018-11-09: Version 1.3.1 - - Feature: auto scrub invalid messages reported to logger - 2018-11-09: Version 1.3.0 - - Feature: upgrade Ember to 3.5.1 - Feature: remove inline JS for CSP compliance - 2018-08-13: Version 1.2.10 - - Feature: expose chained loggers in Logster::Logger - 2017-10-27: Version 1.2.8 - - Fix: `Logster::Middleware::DebugExceptions` is passed a request in Rails 5 instead of the env. - 2017-01-30: Version 1.2.7 - - Feature: Add override_level to Logster::Logger allowing for threadsafe logger override - 2016-10-24: Version 1.2.6 - - Fix: Check if `Rails.env` is defined when using Logster in a none Rails project. - 2016-07-11: Version 1.2.5 - - Fix: Chained `Logster::Logger` logger now receives backtrace as well. - 2016-05-05: Version 1.2.4 - - Fix: XSS in log message show if attacker can inject script into ENV - 2016-05-05: Version 1.2.3 - - Fix: clear_all now also clears rate limits - Fix: protect against corrupt data in redis during clear - 2016-03-22: Version 1.2.2 - - Fix: Conflicting attributes and method name for `Logster::RedisStore#rate_limits`. - Fix: Rate limit checker was tracking limits too early. It should only track when a message has been bumped or saved. - 2016-03-22: Version 1.2.1 - - Feature: Add method to retrieve current rate from rate limiters. - Feature: Make `RedisStore#rate_limits` readable. - Feature: Make `RedisRateLimiter#callback` and `RedisRateLimiter#duration` readable. - 2016-03-18: Version 1.2.0 - - Fix: Move Redis configuration into RedisStore. - Feature: Allow `RedisStore#redis_prefix` to either be a String or a Proc. - 2016-02-11: Version 1.1.1 - - Feature: Error rate can now be tracked in one minute and one hour buckets. - 2015-11-27: Version 1.0.1 - - New assets and logster logo - Added favicon - Added title - Use rails logger instead of invoking store - 2015-08-18: Version 0.9.9 - - This marks the largest release of Logster to date, it has been in production use for quite a while, hence the version bump. - Feature: automatically group errors in production mode, can be manually controlled via Logster.config.allow_grouping - Feature: automatically track application version, can be manually controlled via Logster.config.application_version @@ -359,46 +289,36 @@ - Fix: protect/unprotect redirected to show page - 2015-06-16: Version 0.8.3 - - Chained loggers now respect chain ignore - Add hostname and process_id to env on all messages - 2015-06-10: Version 0.8.2 - - Add hostname and process_id to env on all messages - 2015-05-01: Version 0.8.1 - - Don't crash out logging routine if redis is down or stderr is closed - 2015-04-16: Version 0.8.0 - - Improve formatting of /show page - Big version bump cause it is quite stable - 2015-02-27: Version 0.1.7 - - Fix invalid request on ?test - 2014-08-05: Version 0.1.3 - - Automatically include ignore filter - 2014-08-13: Version 0.1.6 - - Simplify install process - Fix crash on 404 in /logs dir - 2014-08-10: Version 0.1.5 - - Fix crash in Rails 3 - 2014-08-08: Version 0.1.4 - - Fix crash in ignore filter - 2014-07-17: Version 0.1.1 - - Refactored report method into base_store.rb - will be easier to make a new log store - Add link in UI to clear all (non-protected) logs - Add example of submitting logs from Sidekiq jobs @@ -406,42 +326,33 @@ - Render hashes provided via Logster.add_to_env - 2014-07-04: Version 0.0.12 - - Feature: Able to share logs, at /logs/show/(hexdigits) - Add protecting logs, so they aren't deleted when old (for use with sharing) - Restructured Redis data model - 2014-05-24: Version 0.0.10 - - Correct context for error reporting - Clean up backtraces of reported exceptions - 2014-05-13: Version 0.0.9 - - Stray debugger message removed, add window.location logging to js - 2014-05-13: Version 0.0.8 - - Fix packaging binstubs by mistake - 2014-05-13: Version 0.0.7 - - Add support for javascript exception logging - 2014-05-12: Version 0.0.6 - - Add referer to env - 2014-05-12: Version 0.0.5 - - Feature: We now log basic rack environment with the messages - Add your own with Logster.add_to_env(env, key, value) - 2014-05-07: Version 0.0.4 - - Feature: Ability to ignore patterns with Logster.store.ignore = [/regex/] - Feature: Store backtraces, allow people to view them in the GUI - 2014-05-07: Started changelog :) - - Report params in env tab diff --git a/Rakefile b/Rakefile index ed5b072..960f372 100644 --- a/Rakefile +++ b/Rakefile @@ -12,10 +12,7 @@ task(default: :test) desc "Starts Sinatra and Ember servers" task :client_dev do begin - pid = - spawn( - "cd website && LOGSTER_ENV=development BUNDLE_GEMFILE=Gemfile bundle exec rackup --host 0.0.0.0", - ) + pid = spawn("cd website && LOGSTER_ENV=development BUNDLE_GEMFILE=Gemfile bundle exec puma") pid2 = spawn("cd client-app && npx ember s --proxy http://localhost:9292") Process.wait pid Process.wait pid2 diff --git a/client-app/app/controllers/index.js b/client-app/app/controllers/index.js index 639b7ee..8bad189 100644 --- a/client-app/app/controllers/index.js +++ b/client-app/app/controllers/index.js @@ -15,6 +15,8 @@ export default class IndexController extends Controller { @tracked loading = false; @tracked buildingGroupingPattern = false; @tracked rowMessagesForGroupingPattern = []; + @tracked showGroupingPatternDialog = false; + @tracked groupingPatternValue = ""; showDebug = getLocalStorage("showDebug", false); showInfo = getLocalStorage("showInfo", false); @@ -215,32 +217,49 @@ export default class IndexController extends Controller { } @action - async createGroupingPatternFromSelectedRows() { + createGroupingPatternFromSelectedRows() { let match = this.findLongestMatchingPrefix( this.rowMessagesForGroupingPattern ); match = this.escapeRegExp(match); - if ( - match.trim().length && - // eslint-disable-next-line no-alert - confirm( - `Do you want to create the grouping pattern\n\n"${match}"\n\nCancel = No, OK = Create` - ) - ) { - await ajax("/patterns/grouping.json", { - method: "POST", - data: { - pattern: match, - }, - }); - this.rowMessagesForGroupingPattern = []; - this.buildingGroupingPattern = false; - this.model.reload(); - } else if (!match.trim().length) { + if (!match.trim().length) { // eslint-disable-next-line no-alert alert("Can not create a grouping pattern with the given rows"); + return; } + + this.groupingPatternValue = match; + this.showGroupingPatternDialog = true; + } + + @action + updateGroupingPatternValue(event) { + this.groupingPatternValue = event.target.value; + } + + @action + async confirmGroupingPattern() { + const pattern = this.groupingPatternValue.trim(); + if (!pattern.length) { + return; + } + + await ajax("/patterns/grouping.json", { + method: "POST", + data: { pattern }, + }); + this.showGroupingPatternDialog = false; + this.groupingPatternValue = ""; + this.rowMessagesForGroupingPattern = []; + this.buildingGroupingPattern = false; + this.model.reload(); + } + + @action + cancelGroupingPattern() { + this.showGroupingPatternDialog = false; + this.groupingPatternValue = ""; } findLongestMatchingPrefix(strings) { diff --git a/client-app/app/styles/app.css b/client-app/app/styles/app.css index 60f1236..7e63f16 100644 --- a/client-app/app/styles/app.css +++ b/client-app/app/styles/app.css @@ -731,6 +731,60 @@ label span { margin-top: 10px; } +.grouping-pattern-dialog-overlay { + position: fixed; + z-index: 100000; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.5); + display: flex; + align-items: center; + justify-content: center; +} + +.grouping-pattern-dialog { + background: #fff; + border-radius: 4px; + padding: 20px; + min-width: 600px; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); +} + +.grouping-pattern-dialog h3 { + margin: 0 0 8px 0; + font-size: 1em; + font-weight: bold; +} + +.grouping-pattern-dialog p { + margin: 0 0 10px 0; + font-size: 0.9em; + color: #555; +} + +.grouping-pattern-input { + width: 100%; + box-sizing: border-box; + padding: 8px; + font-size: 1.1em; + font-family: monospace; + border: 1px solid #ccc; + border-radius: 3px; + margin-bottom: 14px; +} + +.grouping-pattern-dialog-buttons { + display: flex; + justify-content: flex-end; + gap: 8px; +} + +.grouping-pattern-dialog .btn { + padding: 12px; +} + .backtrace-line .line-link { color: #9e9e9e; margin-left: 3px; @@ -826,4 +880,19 @@ label span { #back-to-site-panel { background-color: #181818; } + + .grouping-pattern-dialog { + background: #262626; + color: #cecece; + } + + .grouping-pattern-dialog p { + color: #aaa; + } + + .grouping-pattern-input { + background: #181818; + color: #cecece; + border-color: #555; + } } diff --git a/client-app/app/templates/index.hbs b/client-app/app/templates/index.hbs index 1671050..256bae1 100644 --- a/client-app/app/templates/index.hbs +++ b/client-app/app/templates/index.hbs @@ -162,4 +162,31 @@ +{{#if this.showGroupingPatternDialog}} +
+{{/if}} +