Skip to content

Commit

Permalink
FEATURE: Linkify backtrace lines to github (#104)
Browse files Browse the repository at this point in the history
This allows Logster to construct GitHub URLs for each backtrace line based on a config provided by you that maps paths on the file system to GitHub repository URLs.

The config for a Rails app may look like this:

```ruby
Logster.config.project_directories = [
  { path: Rails.root.to_s, url: "https://github.com/<your_org>/<your_repo>" }
]
```

The GitHub links will point to the `master` branch. Add a boolean key `main_app: true` to the hash to instruct Logster to use the `application_version` attribute from the env tab when constructing the links.
  • Loading branch information
OsamaSayegh committed Jan 3, 2020
1 parent 1b87341 commit 294e13f
Show file tree
Hide file tree
Showing 20 changed files with 435 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -6,6 +6,8 @@ matrix:
rvm:
- 2.3.4
- 2.5.3
- 2.6.5
- 2.7.0

services:
- redis-server
Expand Down
5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -44,7 +44,10 @@ Logster can be configured using `Logster.config`:
- `Logster.config.rate_limit_error_reporting` : controls automatic 1 minute rate limiting for JS error reporting.
- `Logster.config.web_title` : `<title>` tag for logster error page.
- `Logster.config.enable_custom_patterns_via_ui` : enable the settings page (`/settings`) where you can add suppression and grouping patterns.
- `Logster.config.maximum_message_size_bytes` : specifiy a size in bytes that a message cannot exceed. Note this isn't 100% accurate, meaning a message may still grow above the limit, but it shouldn't grow by more tha, say, 2000 bytes.
- `Logster.config.maximum_message_size_bytes` : specify a size in bytes that a message cannot exceed. Note this isn't 100% accurate, meaning a message may still grow above the limit, but it shouldn't grow by more than, say, 2000 bytes.
- `Logster.config.project_directories` : This should be an array of hashes that map paths on the local filesystem to GitHub repository URLs. If this feature is enabled, Logster will parse backtraces and try to construct a GitHub URL to the exact file and line number for each line in the backtrace. For a Rails app, the config may look like this: `Logster.config.project_directories = [{ path: Rails.root.to_s, url: "https://github.com/<your_org>/<your_repo>" }]`. The GitHub links that are constructed will use the `master` branch. If you want Logster to use the `application_version` attribute from the `env` tab so that the GitHub links point to the exact version of the app when the log message is created, add `main_app: true` key to the hash.
- `Logster.config.enable_backtrace_links` : Enable/disable the backtrace links feature.
- `Logster.config.gems_dir` : The value of this config is `Gem.dir + "/gems/"` by default. You probably don't need to change this config, but it's available in case your app gems are installed in a different directory. An example where this config is needed is Logster [demo site](http://logster.info/logs/): [https://github.com/discourse/logster/blob/master/website/sample.rb#L77](https://github.com/discourse/logster/blob/master/website/sample.rb#L77).

### Tracking Error Rate
Logster allows you to register a callback when the rate of errors has exceeded
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -17,6 +17,7 @@ task :client_dev do
Process.wait pid
Process.wait pid2
rescue Interrupt => e
sleep 0.5
puts "Done!"
exit 0
end
Expand Down
34 changes: 27 additions & 7 deletions assets/javascript/client-app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/stylesheets/client-app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 294e13f

Please sign in to comment.