logster 1.4.0.pre → 2.0.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +7 -1
- data/assets/javascript/client-app.js +1 -1
- data/assets/stylesheets/client-app.css +1 -1
- data/client-app/app/styles/app.css +11 -1
- data/lib/examples/sidekiq_logster_reporter.rb +1 -1
- data/lib/logster.rb +1 -1
- data/lib/logster/base_store.rb +20 -6
- data/lib/logster/configuration.rb +1 -1
- data/lib/logster/ignore_pattern.rb +12 -12
- data/lib/logster/logger.rb +3 -3
- data/lib/logster/message.rb +23 -64
- data/lib/logster/middleware/reporter.rb +2 -3
- data/lib/logster/middleware/viewer.rb +16 -16
- data/lib/logster/rails/railtie.rb +0 -1
- data/lib/logster/redis_store.rb +55 -21
- data/lib/logster/version.rb +1 -1
- data/logster.gemspec +1 -0
- data/test/fake_data/generate.rb +1 -1
- data/test/logster/middleware/test_reporter.rb +0 -2
- data/test/logster/middleware/test_viewer.rb +4 -4
- data/test/logster/test_base_store.rb +15 -15
- data/test/logster/test_ignore_pattern.rb +6 -6
- data/test/logster/test_logger.rb +12 -6
- data/test/logster/test_message.rb +40 -14
- data/test/logster/test_redis_store.rb +200 -30
- metadata +17 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 18cfb59f0fc2db337d3efc3b5d26b5ede5ac681cc599227b1564f500c17e5946
|
|
4
|
+
data.tar.gz: def563ba311997843ad3c30d8520e93d50b708f8d514ca180ad9fa20020a5ea6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6351baad87ed818542d852e2b8c372231759cd508c8f5a6034e215ad585c3c9d81dc6d1865f0f343d6c5d39364efd1b10352abfa25c72a5099738d3525a6dc81
|
|
7
|
+
data.tar.gz: 8a81f0243db890dcb706c5bed34e286ebea5ed85132afcea112a7c3b12894997d1153bedeac7c44b7e44de7b29085730d945a610f2ff69cbc1b76f7b9a6dca2c
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
inherit_from: https://raw.githubusercontent.com/discourse/discourse/master/.rubocop.yml
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
-
- 2019-01-
|
|
3
|
+
- 2019-01-17: Version 2.0.0.pre
|
|
4
|
+
- FIX: don't merge any new env samples if there are 50 samples (1.4.0.pre regression)
|
|
5
|
+
- UX: make env navigation controls stick to the top when scrolled
|
|
6
|
+
- PERF: store env samples separately from the rest of message data
|
|
7
|
+
- DEV: Rubocop
|
|
8
|
+
|
|
9
|
+
- 2019-01-09: Version 1.4.0.pre
|
|
4
10
|
- FEATURE: allow navigation through merged errors
|
|
5
11
|
- FEATURE: search should look at env
|
|
6
12
|
- FIX: deselect message if new filtering doesn't include selected message
|
|
@@ -97,4 +97,4 @@ this.refreshInterval=setInterval(function(){a+=1
|
|
|
97
97
|
var e=(0,n.isHidden)(),i=!e
|
|
98
98
|
e&&a%s==0&&(i=!0,s<20&&s++),i&&(t.loadMore(),e||(s=1))},3e3),this.events.on("panelResized",function(t){e.resizePanels(t)})},deactivate:function(){clearInterval(this.refreshInterval)}})}),define("client-app/routes/show",["exports","client-app/models/message","client-app/lib/utilities"],function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=Ember.Route.extend({model:function(e){return(0,n.preloadOrAjax)("/show/"+e.id+".json")},setupController:function(e,n){this._super.apply(this,arguments),e.set("model",t.default.create(n))}})})
|
|
99
99
|
define("client-app/services/ajax",["exports","ember-ajax/services/ajax"],function(e,t){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.default}})}),define("client-app/templates/application",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=Ember.HTMLBars.template({id:"yOsrYpw5",block:'{"symbols":[],"statements":[[1,[21,"update-time"],false],[0,"\\n"],[1,[21,"outlet"],false],[0,"\\n"]],"hasEval":false}',meta:{moduleName:"client-app/templates/application.hbs"}})}),define("client-app/templates/components/actions-menu",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=Ember.HTMLBars.template({id:"ebB3+Z4x",block:'{"symbols":["&default"],"statements":[[4,"if",[[23,["actionsInMenu"]]],null,{"statements":[[4,"if",[[23,["showMenu"]]],null,{"statements":[[0," "],[7,"div"],[11,"class","actions-menu"],[9],[0,"\\n "],[14,1],[0,"\\n "],[10],[0,"\\n"]],"parameters":[]},null],[0," "],[7,"button"],[11,"class","expand btn no-text"],[3,"action",[[22,0,[]],"expandMenu"]],[9],[7,"i"],[11,"class","fa fa-ellipsis-h"],[9],[10],[10],[0,"\\n "],[7,"button"],[11,"class","share btn"],[3,"action",[[22,0,[]],"share"]],[9],[7,"i"],[11,"class","fa fa-share"],[9],[10],[7,"span"],[9],[0,"Share"],[10],[10],[0,"\\n"]],"parameters":[]},{"statements":[[0," "],[14,1],[0,"\\n "],[7,"button"],[11,"class","share btn"],[3,"action",[[22,0,[]],"share"]],[9],[7,"i"],[11,"class","fa fa-share"],[9],[10],[7,"span"],[9],[0,"Share"],[10],[10],[0,"\\n"]],"parameters":[]}]],"hasEval":false}',meta:{moduleName:"client-app/templates/components/actions-menu.hbs"}})}),define("client-app/templates/components/env-tab",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=Ember.HTMLBars.template({id:"5078JpTW",block:'{"symbols":[],"statements":[[4,"if",[[23,["isEnvArray"]]],null,{"statements":[[0," "],[7,"div"],[11,"class","nav-controls"],[9],[0,"\\n "],[7,"button"],[12,"disabled",[21,"disableBackButtons"]],[11,"class","btn nav-btn no-text"],[3,"action",[[22,0,[]],"bigJump","back"]],[9],[7,"i"],[11,"class","fa fa-fast-backward"],[9],[10],[10],[0,"\\n "],[7,"button"],[12,"disabled",[21,"disableBackButtons"]],[11,"class","btn nav-btn no-text"],[3,"action",[[22,0,[]],"takeStep","back"]],[9],[7,"i"],[11,"class","fa fa-backward"],[9],[10],[10],[0,"\\n "],[7,"span"],[11,"class","env-number"],[9],[1,[21,"current"],false],[0,"/"],[1,[23,["message","env","length"]],false],[10],[0,"\\n "],[7,"button"],[12,"disabled",[21,"disableForwardButtons"]],[11,"class","btn nav-btn no-text"],[3,"action",[[22,0,[]],"takeStep","front"]],[9],[7,"i"],[11,"class","fa fa-forward"],[9],[10],[10],[0,"\\n "],[7,"button"],[12,"disabled",[21,"disableForwardButtons"]],[11,"class","btn nav-btn no-text"],[3,"action",[[22,0,[]],"bigJump","front"]],[9],[7,"i"],[11,"class","fa fa-fast-forward"],[9],[10],[10],[0,"\\n "],[10],[0,"\\n"]],"parameters":[]},null],[1,[21,"html"],true],[0,"\\n"]],"hasEval":false}',meta:{moduleName:"client-app/templates/components/env-tab.hbs"}})}),define("client-app/templates/components/message-info",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=Ember.HTMLBars.template({id:"SK12lkYh",block:'{"symbols":["btn"],"statements":[[7,"div"],[11,"class","message-info"],[9],[0,"\\n"],[4,"tabbed-section",null,null,{"statements":[[4,"tab-contents",null,[["name","hint","currentMessage"],["info","show info",[23,["currentMessage"]]]],{"statements":[[4,"if",[[23,["showTitle"]]],null,{"statements":[[0," "],[7,"h3"],[9],[0,"Message\\n"],[4,"if",[[23,["currentMessage","showCount"]]],null,{"statements":[[0," ("],[1,[23,["currentMessage","count"]],false],[0," copies reported)\\n"]],"parameters":[]},null],[0," "],[10],[0,"\\n"]],"parameters":[]},null],[0," "],[7,"pre"],[9],[1,[23,["currentMessage","message"]],false],[10],[0,""]],"parameters":[]},null],[4,"tab-contents",null,[["name","defaultTab","hint","currentMessage"],["backtrace","true","show backtrace",[23,["currentMessage"]]]],{"statements":[[4,"if",[[23,["showTitle"]]],null,{"statements":[[0," "],[7,"h3"],[9],[0,"Backtrace"],[10],[0,"\\n"]],"parameters":[]},null],[0," "],[7,"pre"],[9],[1,[23,["currentMessage","backtrace"]],false],[10],[0,""]],"parameters":[]},null],[4,"if",[[23,["currentMessage","env"]]],null,{"statements":[[4,"tab-contents",null,[["className","name","hint","currentMessage"],["env","env","show environment",[23,["currentMessage"]]]],{"statements":[[4,"if",[[23,["showTitle"]]],null,{"statements":[[0," "],[7,"h3"],[9],[0,"Env"],[10],[0,"\\n"]],"parameters":[]},null],[0," "],[1,[27,"env-tab",null,[["message"],[[23,["currentMessage"]]]]],false],[0,"\\n"]],"parameters":[]},null]],"parameters":[]},null]],"parameters":[]},null],[0,"\\n"],[4,"if",[[23,["currentMessage"]]],null,{"statements":[[0," "],[7,"div"],[11,"class","message-actions"],[9],[0,"\\n"],[4,"actions-menu",null,[["actionsInMenu","share"],[[23,["actionsInMenu"]],[27,"action",[[22,0,[]],"share"],null]]],{"statements":[[4,"each",[[23,["buttons"]]],null,{"statements":[[0," "],[7,"button"],[12,"class",[28,[[22,1,["klass"]]," btn ",[27,"if",[[22,1,["danger"]],"danger",""],null]]]],[3,"action",[[22,0,[]],[22,1,["action"]]]],[9],[0,"\\n "],[7,"i"],[12,"class",[28,["fa fa-",[22,1,["icon"]]]]],[9],[10],[0,"\\n "],[7,"span"],[9],[1,[22,1,["label"]],false],[10],[0,"\\n "],[10],[0,"\\n"]],"parameters":[1]},null]],"parameters":[]},null],[0," "],[10],[0,"\\n"]],"parameters":[]},null],[10],[0,"\\n"]],"hasEval":false}',meta:{moduleName:"client-app/templates/components/message-info.hbs"}})}),define("client-app/templates/components/message-row",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=Ember.HTMLBars.template({id:"pF0hQ9a+",block:'{"symbols":[],"statements":[[7,"div"],[11,"class","count"],[9],[0,"\\n"],[4,"if",[[23,["model","showCount"]]],null,{"statements":[[0," "],[1,[23,["model","count"]],false],[0,"\\n"]],"parameters":[]},null],[10],[0,"\\n"],[7,"div"],[11,"class","severity"],[9],[1,[23,["model","glyph"]],true],[10],[0,"\\n"],[7,"div"],[11,"class","message-body"],[9],[0,"\\n "],[1,[23,["model","displayMessage"]],false],[0,"\\n"],[10],[0,"\\n"],[7,"div"],[11,"class","protected"],[9],[0,"\\n"],[4,"if",[[23,["model","protected"]]],null,{"statements":[[0," "],[7,"i"],[11,"title","message is protected, clearing will not remove it"],[11,"class","fa fa-lock"],[9],[10],[0,"\\n"]],"parameters":[]},null],[10],[0,"\\n"],[7,"div"],[11,"class","time"],[9],[1,[27,"time-formatter",null,[["timestamp"],[[23,["model","timestamp"]]]]],false],[10],[0,"\\n"]],"hasEval":false}',meta:{moduleName:"client-app/templates/components/message-row.hbs"}})}),define("client-app/templates/components/panel-resizer",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=Ember.HTMLBars.template({id:"FLUzT7ST",block:'{"symbols":[],"statements":[[7,"div"],[11,"class","line-1"],[9],[10],[0,"\\n"],[7,"div"],[11,"class","line-2"],[9],[10],[0,"\\n"],[7,"div"],[11,"class","line-3"],[9],[10],[0,"\\n"]],"hasEval":false}',meta:{moduleName:"client-app/templates/components/panel-resizer.hbs"}})}),define("client-app/templates/components/tabbed-section",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=Ember.HTMLBars.template({id:"nreTgL17",block:'{"symbols":["tab","&default"],"statements":[[14,2],[0,"\\n"],[7,"ul"],[11,"class","tabs"],[9],[0,"\\n"],[4,"each",[[23,["tabs"]]],null,{"statements":[[0," "],[7,"li"],[9],[0,"\\n "],[7,"a"],[12,"title",[28,[[27,"unbound",[[22,1,["hint"]]],null]]]],[11,"href","#"],[12,"class",[28,[[27,"if",[[22,1,["active"]],"active"],null]]]],[3,"action",[[22,0,[]],[23,["selectTab"]],[22,1,[]]]],[9],[0,"\\n "],[1,[27,"unbound",[[22,1,["name"]]],null],false],[0,"\\n "],[10],[0,"\\n "],[10],[0,"\\n"]],"parameters":[1]},null],[10],[0,"\\n"]],"hasEval":false}',meta:{moduleName:"client-app/templates/components/tabbed-section.hbs"}})}),define("client-app/templates/components/time-formatter",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=Ember.HTMLBars.template({id:"sp53cTcH",block:'{"symbols":[],"statements":[[1,[21,"time"],false],[0,"\\n"]],"hasEval":false}',meta:{moduleName:"client-app/templates/components/time-formatter.hbs"}})}),define("client-app/templates/index",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=Ember.HTMLBars.template({id:"whComJMa",block:'{"symbols":["message"],"statements":[[7,"div"],[11,"id","top-panel"],[9],[0,"\\n "],[7,"div"],[11,"id","log-table"],[9],[0,"\\n"],[4,"if",[[23,["model","moreBefore"]]],null,{"statements":[[0," "],[7,"div"],[11,"class","show-more"],[3,"action",[[22,0,[]],"showMoreBefore"]],[9],[0,"\\n"],[4,"if",[[23,["model","hideCountInLoadMore"]]],null,{"statements":[[0," Load more\\n"]],"parameters":[]},{"statements":[[0," Select to see "],[1,[23,["model","totalBefore"]],false],[0," more\\n"]],"parameters":[]}],[0," "],[10],[0,"\\n"]],"parameters":[]},null],[4,"each",[[23,["model","messages"]]],null,{"statements":[[0," "],[1,[27,"message-row",null,[["model","selectedMessage"],[[22,1,[]],[27,"action",[[22,0,[]],"selectMessage"],null]]]],false],[0,"\\n"]],"parameters":[1]},null],[0," "],[10],[0,"\\n"],[10],[0,"\\n"],[7,"div"],[11,"id","bottom-panel"],[9],[0,"\\n "],[1,[27,"message-info",null,[["currentMessage","removeMessage","solveMessage","actionsInMenu"],[[23,["currentMessage"]],[27,"action",[[22,0,[]],"removeMessage"],null],[27,"action",[[22,0,[]],"solveMessage"],null],[23,["actionsInMenu"]]]]],false],[0,"\\n\\n "],[7,"div"],[11,"class","action-panel"],[9],[0,"\\n "],[7,"div"],[11,"class","severity-filters"],[9],[0,"\\n "],[7,"div"],[11,"class","more-wrapping"],[9],[0,"\\n "],[7,"label"],[11,"class","debug"],[9],[0,"\\n "],[1,[27,"input",null,[["type","checked"],["checkbox",[23,["showDebug"]]]]],false],[0,"\\n "],[7,"span"],[9],[0,"Debug"],[10],[0,"\\n "],[10],[0,"\\n "],[7,"label"],[11,"class","info"],[9],[0,"\\n "],[1,[27,"input",null,[["type","checked"],["checkbox",[23,["showInfo"]]]]],false],[0,"\\n "],[7,"span"],[9],[0,"Info"],[10],[0,"\\n "],[10],[0,"\\n "],[7,"label"],[11,"class","warn"],[9],[0,"\\n "],[1,[27,"input",null,[["type","checked"],["checkbox",[23,["showWarn"]]]]],false],[0,"\\n "],[7,"i"],[11,"class","fa fa-exclamation-circle warning"],[9],[10],[0,"\\n "],[7,"span"],[9],[0,"Warning"],[10],[0,"\\n "],[10],[0,"\\n "],[7,"label"],[11,"class","error"],[9],[0,"\\n "],[1,[27,"input",null,[["type","checked"],["checkbox",[23,["showErr"]]]]],false],[0,"\\n "],[7,"i"],[11,"class","fa fa-times-circle error"],[9],[10],[0,"\\n "],[7,"span"],[9],[0,"Error"],[10],[0,"\\n "],[10],[0,"\\n "],[7,"label"],[11,"class","fatal"],[9],[0,"\\n "],[1,[27,"input",null,[["type","checked"],["checkbox",[23,["showFatal"]]]]],false],[0,"\\n "],[7,"i"],[11,"class","fa fa-times-circle fatal"],[9],[10],[0,"\\n "],[7,"span"],[9],[0,"Fatal"],[10],[0,"\\n "],[10],[0,"\\n "],[10],[0,"\\n "],[10],[0,"\\n "],[7,"div"],[11,"class","search-clear-all"],[9],[0,"\\n "],[1,[27,"input",null,[["type","class","placeholder","value"],["textfield","search","Search",[23,["search"]]]]],false],[0,"\\n "],[7,"button"],[11,"class","clear btn danger"],[3,"action",[[22,0,[]],"clear"]],[9],[7,"i"],[11,"class","fa fa-times"],[9],[10],[7,"span"],[9],[0,"Clear logs"],[10],[10],[0,"\\n "],[10],[0,"\\n "],[10],[0,"\\n"],[10],[0,"\\n"],[1,[21,"panel-resizer"],false],[0,"\\n"]],"hasEval":false}',meta:{moduleName:"client-app/templates/index.hbs"}})}),define("client-app/templates/show",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=Ember.HTMLBars.template({id:"V916vpg9",block:'{"symbols":[],"statements":[[4,"link-to",["index"],null,{"statements":[[0,"Recent"]],"parameters":[]},null],[0,"\\n"],[7,"div"],[11,"id","bottom-panel"],[11,"class","full"],[9],[0,"\\n "],[1,[27,"message-info",null,[["currentMessage","showTitle","actionsInMenu"],[[23,["model"]],"true",false]]],false],[0,"\\n"],[10],[0,"\\n"]],"hasEval":false}',meta:{moduleName:"client-app/templates/show.hbs"}})}),define("client-app/config/environment",[],function(){try{var e="client-app/config/environment",t=document.querySelector('meta[name="'+e+'"]').getAttribute("content"),n={default:JSON.parse(unescape(t))}
|
|
100
|
-
return Object.defineProperty(n,"__esModule",{value:!0}),n}catch(a){throw new Error('Could not read config from meta tag with name "'+e+'".')}}),runningTests||require("client-app/app").default.create({name:"client-app",version:"0.0.0+
|
|
100
|
+
return Object.defineProperty(n,"__esModule",{value:!0}),n}catch(a){throw new Error('Could not read config from meta tag with name "'+e+'".')}}),runningTests||require("client-app/app").default.create({name:"client-app",version:"0.0.0+8710f335"})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.divider,.message-info{border-bottom:1px solid #ddd}body{font-family:Roboto,Arial,"Liberation Sans","DejaVu Sans",sans-serif;font-size:12px}body.mobile,body.mobile .message{font-size:14px}pre{font-family:"Roboto Mono",Consolas,Monaco,Ubuntu Mono,monospace}table.env-table tbody tr td{border-top:none;line-height:18px;vertical-align:top}table.env-table,table.env-table table{border-spacing:0;border-collapse:collapse}table.env-table td{padding-right:5px}tbody tr{width:98%}.message-row{display:flex}.message-row .protected,.message-row .severity{text-align:center;width:25px;flex-grow:0;flex-shrink:0;font-size:12px}.message-row div{border-top:.5px #e9e9e9 solid;padding-top:1px;padding-bottom:1px;line-height:25px}.message-row .count{width:30px;flex-grow:0;flex-shrink:0;padding-right:4px;box-sizing:border-box;font-size:11px;font-weight:700;text-align:right}.message-row .message-body{flex-grow:1;flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:13px}.message-row .time{flex-grow:0;flex-shrink:0;color:#999;vertical-align:top;font-size:12px;padding-right:8px}.action-panel .clear,.action-panel .search,.action-panel i.fa,.btn .fa,.btn span,input,label span{vertical-align:middle}.message-row:hover{background-color:#f8f8f8;cursor:pointer}.message-row.selected{background-color:#dfdfdf}i.fatal{color:#e00}i.error{color:#900}i.warning{color:#feb800}.debug{color:#777}.btn,.tabs a{text-decoration:none;color:#333}.action-panel .search{border:1px solid #ddd;padding:3px;box-sizing:border-box}#log-table .show-more{text-align:center;height:30px;line-height:30px;text-decoration:none;background-color:#ddd;cursor:pointer;margin-top:8px}#overlay,.divider{cursor:row-resize}#bottom-panel{position:fixed;bottom:0;left:0;right:0;height:300px;background-color:#f1f1f1;padding:0 8px 8px;z-index:2}#bottom-panel.full{position:static;background-color:inherit;height:90%}#bottom-panel.full>div{padding-bottom:40px}#bottom-panel.full .tabs{display:none}#bottom-panel.full .message-info{position:static}#bottom-panel.full .message-info .content{display:block;position:static}#bottom-panel.full button.delete,.hidden{display:none}#bottom-panel.full .save,#bottom-panel.full .share{bottom:10px}#bottom-panel.full .message-actions button{margin-top:8px}#bottom-panel.full .message-actions{position:fixed;height:40px;width:100%;left:0;bottom:0;background-color:#eee;border-top:1px solid #dfdfdf;padding-left:10px}.divider,.tabs{border-top:1px solid #ddd}.message-actions{position:absolute;bottom:5px;right:0;margin-right:10px}.message-actions button{margin-left:5px}.divider{position:fixed;bottom:310px;left:0;right:0;height:15px;background-color:#fafafa}.divider div{margin:auto;width:24px;height:1px;background-color:#ccc;position:relative}.divider .line-1{top:5px}.divider .line-2{top:6px}.divider .line-3{top:7px}#top-panel{position:fixed;top:0;left:0;right:0;bottom:320px;overflow:auto}.action-panel,.message-info{position:absolute;left:0;right:0}.message-info{top:0}.action-panel{bottom:0;font-weight:700}.action-panel input{margin:0}.severity-filters label{margin-right:18px}.action-panel .clear{float:right}#log-table{margin:auto;width:99%}.message-info .env-table,.message-info pre{position:relative;margin:10px}#overlay{position:fixed;z-index:99999;top:0;bottom:0;left:0;right:0;opacity:0}.message-info .content,.tabs{position:absolute;left:0;right:0}.message-info .content{top:0;bottom:35px;overflow:auto;display:none}.message-info .content.active{display:block}.tabs{bottom:13px;list-style-type:none;margin:0 0 5px;padding:0 0 0 10px}.tabs a,.tabs li{position:relative}.tabs li{float:left;padding-right:5px;margin:0}.tabs a{top:6px;border:1px solid #ddd;border-top:none;border-bottom-left-radius:5px;border-bottom-right-radius:5px;padding:6px;background-color:#e1e1e1}.tabs a.active{border-top:1px solid #f1f1f1;background-color:#f1f1f1}.btn{display:inline-block;margin:0;padding:5px 12px;font-size:1em;line-height:0;text-align:center;cursor:pointer;transition:all .25s;background-color:#ddd;border:none;font-weight:400}.btn:hover{color:#000;background-color:#ccc}.btn .fa{margin-right:7px}.btn:active{text-shadow:none}.btn.danger:hover{background-color:#c63c1b;color:#eee}.search-clear-all .clear,.search-clear-all .search{height:24px}.search-clear-all .clear,.search-clear-all .search,.severity-filters label{align-self:center}.search-clear-all .clear{margin-left:auto}@media (min-width:701px){.search-clear-all,.severity-filters{height:100%}.more-wrapping,.search-clear-all,.severity-filters{display:flex}.severity-filters{float:left}.action-panel{padding:10px;box-sizing:border-box;height:42px}.message-info{bottom:42px}}@media (max-width:700px){.severity-filters{padding:10px}.search-clear-all{padding:0 10px 10px}.action-panel{height:69px}.message-info{bottom:69px}}@media (max-width:415px){.severity-filters{overflow-x:scroll;overflow-y:hidden;white-space:nowrap}.more-wrapping:after,.more-wrapping:before{content:"";position:absolute;height:18px}.more-wrapping:before{width:15px;margin-left:-10px;background:linear-gradient(to right,#f1f1f1 0,rgba(241,241,241,.001) 100%)}.more-wrapping:after{right:0;width:23px;background:linear-gradient(to left,#f1f1f1 0,rgba(241,241,241,.001) 100%)}}.btn.no-text .fa{margin:0}.btn[disabled]{opacity:.5}.actions-menu{position:absolute;background:#fafafa;display:inline-flex;flex-direction:column;bottom:27px;right:45px;width:115px;padding:5px 5px 0;box-shadow:0 4px 14px rgba(0,0,0,.15)}.actions-menu button{margin:0 0 5px;height:27px}.nav-controls{
|
|
1
|
+
.divider,.message-info{border-bottom:1px solid #ddd}body{font-family:Roboto,Arial,"Liberation Sans","DejaVu Sans",sans-serif;font-size:12px}body.mobile,body.mobile .message{font-size:14px}pre{font-family:"Roboto Mono",Consolas,Monaco,Ubuntu Mono,monospace}table.env-table tbody tr td{border-top:none;line-height:18px;vertical-align:top}table.env-table,table.env-table table{border-spacing:0;border-collapse:collapse}table.env-table td{padding-right:5px}tbody tr{width:98%}.message-row{display:flex}.message-row .protected,.message-row .severity{text-align:center;width:25px;flex-grow:0;flex-shrink:0;font-size:12px}.message-row div{border-top:.5px #e9e9e9 solid;padding-top:1px;padding-bottom:1px;line-height:25px}.message-row .count{width:30px;flex-grow:0;flex-shrink:0;padding-right:4px;box-sizing:border-box;font-size:11px;font-weight:700;text-align:right}.message-row .message-body{flex-grow:1;flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:13px}.message-row .time{flex-grow:0;flex-shrink:0;color:#999;vertical-align:top;font-size:12px;padding-right:8px}.action-panel .clear,.action-panel .search,.action-panel i.fa,.btn .fa,.btn span,input,label span{vertical-align:middle}.message-row:hover{background-color:#f8f8f8;cursor:pointer}.message-row.selected{background-color:#dfdfdf}i.fatal{color:#e00}i.error{color:#900}i.warning{color:#feb800}.debug{color:#777}.btn,.tabs a{text-decoration:none;color:#333}.action-panel .search{border:1px solid #ddd;padding:3px;box-sizing:border-box}#log-table .show-more{text-align:center;height:30px;line-height:30px;text-decoration:none;background-color:#ddd;cursor:pointer;margin-top:8px}#overlay,.divider{cursor:row-resize}#bottom-panel{position:fixed;bottom:0;left:0;right:0;height:300px;background-color:#f1f1f1;padding:0 8px 8px;z-index:2}#bottom-panel.full{position:static;background-color:inherit;height:90%}#bottom-panel.full>div{padding-bottom:40px}#bottom-panel.full .tabs{display:none}#bottom-panel.full .message-info{position:static}#bottom-panel.full .message-info .content{display:block;position:static}#bottom-panel.full button.delete,.hidden{display:none}#bottom-panel.full .save,#bottom-panel.full .share{bottom:10px}#bottom-panel.full .message-actions button{margin-top:8px}#bottom-panel.full .message-actions{position:fixed;height:40px;width:100%;left:0;bottom:0;background-color:#eee;border-top:1px solid #dfdfdf;padding-left:10px}.divider,.tabs{border-top:1px solid #ddd}.message-actions{position:absolute;bottom:5px;right:0;margin-right:10px}.message-actions button{margin-left:5px}.divider{position:fixed;bottom:310px;left:0;right:0;height:15px;background-color:#fafafa}.divider div{margin:auto;width:24px;height:1px;background-color:#ccc;position:relative}.divider .line-1{top:5px}.divider .line-2{top:6px}.divider .line-3{top:7px}#top-panel{position:fixed;top:0;left:0;right:0;bottom:320px;overflow:auto}.action-panel,.message-info{position:absolute;left:0;right:0}.message-info{top:0}.action-panel{bottom:0;font-weight:700}.action-panel input{margin:0}.severity-filters label{margin-right:18px}.action-panel .clear{float:right}#log-table{margin:auto;width:99%}.message-info .env-table,.message-info pre{position:relative;margin:5px 10px 10px}#overlay{position:fixed;z-index:99999;top:0;bottom:0;left:0;right:0;opacity:0}.message-info .content,.tabs{position:absolute;left:0;right:0}.message-info .content{top:0;bottom:35px;overflow:auto;display:none}.message-info .content.active{display:block}.tabs{bottom:13px;list-style-type:none;margin:0 0 5px;padding:0 0 0 10px}.tabs a,.tabs li{position:relative}.tabs li{float:left;padding-right:5px;margin:0}.tabs a{top:6px;border:1px solid #ddd;border-top:none;border-bottom-left-radius:5px;border-bottom-right-radius:5px;padding:6px;background-color:#e1e1e1}.tabs a.active{border-top:1px solid #f1f1f1;background-color:#f1f1f1}.btn{display:inline-block;margin:0;padding:5px 12px;font-size:1em;line-height:0;text-align:center;cursor:pointer;transition:all .25s;background-color:#ddd;border:none;font-weight:400}.btn:hover{color:#000;background-color:#ccc}.btn .fa{margin-right:7px}.btn:active{text-shadow:none}.btn.danger:hover{background-color:#c63c1b;color:#eee}.search-clear-all .clear,.search-clear-all .search{height:24px}.search-clear-all .clear,.search-clear-all .search,.severity-filters label{align-self:center}.search-clear-all .clear{margin-left:auto}@media (min-width:701px){.search-clear-all,.severity-filters{height:100%}.more-wrapping,.search-clear-all,.severity-filters{display:flex}.severity-filters{float:left}.action-panel{padding:10px;box-sizing:border-box;height:42px}.message-info{bottom:42px}}@media (max-width:700px){.severity-filters{padding:10px}.search-clear-all{padding:0 10px 10px}.action-panel{height:69px}.message-info{bottom:69px}}@media (max-width:415px){.severity-filters{overflow-x:scroll;overflow-y:hidden;white-space:nowrap}.more-wrapping:after,.more-wrapping:before{content:"";position:absolute;height:18px}.more-wrapping:before{width:15px;margin-left:-10px;background:linear-gradient(to right,#f1f1f1 0,rgba(241,241,241,.001) 100%)}.more-wrapping:after{right:0;width:23px;background:linear-gradient(to left,#f1f1f1 0,rgba(241,241,241,.001) 100%)}}.btn.no-text .fa{margin:0}.btn[disabled]{opacity:.5}.actions-menu{position:absolute;background:#fafafa;display:inline-flex;flex-direction:column;bottom:27px;right:45px;width:115px;padding:5px 5px 0;box-shadow:0 4px 14px rgba(0,0,0,.15);z-index:3}.actions-menu button{margin:0 0 5px;height:27px}.nav-controls{padding:10px}#bottom-panel:not(.full) .nav-controls{position:sticky;top:0;background:#f1f1f1;z-index:1;border-bottom:1px solid #ddd}.env-number{margin:0 7px}
|
|
@@ -289,6 +289,7 @@ label span {
|
|
|
289
289
|
.message-info .env-table {
|
|
290
290
|
position: relative;
|
|
291
291
|
margin: 10px;
|
|
292
|
+
margin-top: 5px;
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
#overlay {
|
|
@@ -490,6 +491,7 @@ label span {
|
|
|
490
491
|
padding: 5px;
|
|
491
492
|
padding-bottom: 0px;
|
|
492
493
|
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
|
|
494
|
+
z-index: 3;
|
|
493
495
|
}
|
|
494
496
|
|
|
495
497
|
.actions-menu button {
|
|
@@ -498,7 +500,15 @@ label span {
|
|
|
498
500
|
}
|
|
499
501
|
|
|
500
502
|
.nav-controls {
|
|
501
|
-
|
|
503
|
+
padding: 10px;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
#bottom-panel:not(.full) .nav-controls {
|
|
507
|
+
position: sticky;
|
|
508
|
+
top: 0;
|
|
509
|
+
background: #f1f1f1;
|
|
510
|
+
z-index: 1;
|
|
511
|
+
border-bottom: 1px solid #ddd;
|
|
502
512
|
}
|
|
503
513
|
|
|
504
514
|
.env-number {
|
data/lib/logster.rb
CHANGED
data/lib/logster/base_store.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Logster
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
# Modify the saved message to the given one (identified by message.key) and bump it to the top of the latest list
|
|
17
|
-
def replace_and_bump(message)
|
|
17
|
+
def replace_and_bump(message, save_env: true)
|
|
18
18
|
not_implemented
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -40,7 +40,17 @@ module Logster
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
# Get a message by its message_key
|
|
43
|
-
def get(message_key)
|
|
43
|
+
def get(message_key, load_env: true)
|
|
44
|
+
not_implemented
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Get a group of messages by their message_keys
|
|
48
|
+
def bulk_get(message_keys)
|
|
49
|
+
not_implemented
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Get a message's env by its message_key
|
|
53
|
+
def get_env(message_key)
|
|
44
54
|
not_implemented
|
|
45
55
|
end
|
|
46
56
|
|
|
@@ -98,19 +108,23 @@ module Logster
|
|
|
98
108
|
message.backtrace = caller.join("\n")
|
|
99
109
|
end
|
|
100
110
|
|
|
101
|
-
return if ignore && ignore.any? { |pattern| message =~ pattern}
|
|
111
|
+
return if ignore && ignore.any? { |pattern| message =~ pattern }
|
|
102
112
|
|
|
103
113
|
similar = nil
|
|
104
114
|
|
|
105
115
|
if Logster.config.allow_grouping
|
|
106
116
|
key = self.similar_key(message)
|
|
107
|
-
similar = get
|
|
117
|
+
similar = get(key, load_env: false) if key
|
|
108
118
|
end
|
|
109
119
|
|
|
110
120
|
if similar
|
|
111
|
-
similar.
|
|
121
|
+
has_env = !similar.env.nil? && !similar.env.empty?
|
|
122
|
+
if similar.count < Logster::MAX_GROUPING_LENGTH && !has_env
|
|
123
|
+
similar.env = get_env(similar.key) || {}
|
|
124
|
+
end
|
|
125
|
+
save_env = similar.merge_similar_message(message)
|
|
112
126
|
|
|
113
|
-
replace_and_bump
|
|
127
|
+
replace_and_bump(similar, save_env: save_env || has_env)
|
|
114
128
|
similar
|
|
115
129
|
else
|
|
116
130
|
save message
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
module Logster
|
|
2
2
|
class IgnorePattern
|
|
3
3
|
|
|
4
|
-
def initialize(message_pattern=nil, env_patterns=nil)
|
|
4
|
+
def initialize(message_pattern = nil, env_patterns = nil)
|
|
5
5
|
@msg_match = message_pattern
|
|
6
6
|
@env_match = env_patterns
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def self.from_message_and_request_uri(msg, request)
|
|
10
|
-
IgnorePattern.new(msg,
|
|
10
|
+
IgnorePattern.new(msg, REQUEST_URI: request)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def matches?(message)
|
|
@@ -32,18 +32,18 @@ module Logster
|
|
|
32
32
|
return false unless message && pattern
|
|
33
33
|
|
|
34
34
|
case pattern
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
else
|
|
43
|
-
false
|
|
44
|
-
end
|
|
35
|
+
when Regexp
|
|
36
|
+
message.to_s =~ pattern
|
|
37
|
+
when String
|
|
38
|
+
message.to_s =~ Regexp.new(pattern, Regexp::IGNORECASE)
|
|
39
|
+
when Hash
|
|
40
|
+
if Hash === message
|
|
41
|
+
compare_hash(message, pattern)
|
|
45
42
|
else
|
|
46
43
|
false
|
|
44
|
+
end
|
|
45
|
+
else
|
|
46
|
+
false
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
data/lib/logster/logger.rb
CHANGED
|
@@ -31,7 +31,7 @@ module Logster
|
|
|
31
31
|
@chained << logger
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def add_to_chained(logger, severity, message, progname, opts=nil, &block)
|
|
34
|
+
def add_to_chained(logger, severity, message, progname, opts = nil, &block)
|
|
35
35
|
if logger.respond_to? :skip_store
|
|
36
36
|
old = logger.skip_store
|
|
37
37
|
logger.skip_store = @skip_store
|
|
@@ -49,7 +49,7 @@ module Logster
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def add(*args, &block)
|
|
52
|
-
add_with_opts(*args
|
|
52
|
+
add_with_opts(*args, &block)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def level
|
|
@@ -57,7 +57,7 @@ module Logster
|
|
|
57
57
|
(ol && ol[Thread.current.object_id]) || @level
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
def add_with_opts(severity, message, progname=progname(), opts=nil, &block)
|
|
60
|
+
def add_with_opts(severity, message, progname = progname(), opts = nil, &block)
|
|
61
61
|
if severity < level
|
|
62
62
|
return true
|
|
63
63
|
end
|
data/lib/logster/message.rb
CHANGED
|
@@ -35,7 +35,7 @@ module Logster
|
|
|
35
35
|
@first_timestamp = nil
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
def to_h
|
|
38
|
+
def to_h(exclude_env: false)
|
|
39
39
|
h = {
|
|
40
40
|
message: @message,
|
|
41
41
|
progname: @progname,
|
|
@@ -44,28 +44,27 @@ module Logster
|
|
|
44
44
|
key: @key,
|
|
45
45
|
backtrace: @backtrace,
|
|
46
46
|
count: @count,
|
|
47
|
-
env: @env,
|
|
48
47
|
protected: @protected
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
if @first_timestamp
|
|
52
|
-
|
|
53
|
-
end
|
|
50
|
+
h[:first_timestamp] = @first_timestamp if @first_timestamp
|
|
51
|
+
h[:env] = @env unless exclude_env
|
|
54
52
|
|
|
55
53
|
h
|
|
56
54
|
end
|
|
57
55
|
|
|
58
56
|
def to_json(opts = nil)
|
|
59
|
-
|
|
57
|
+
exclude_env = Hash === opts && opts.delete(:exclude_env)
|
|
58
|
+
JSON.fast_generate(to_h(exclude_env: exclude_env), opts)
|
|
60
59
|
end
|
|
61
60
|
|
|
62
61
|
def self.from_json(json)
|
|
63
62
|
parsed = ::JSON.parse(json)
|
|
64
|
-
msg = new(
|
|
63
|
+
msg = new(parsed["severity"],
|
|
65
64
|
parsed["progname"],
|
|
66
65
|
parsed["message"],
|
|
67
66
|
parsed["timestamp"],
|
|
68
|
-
parsed["key"]
|
|
67
|
+
parsed["key"])
|
|
69
68
|
msg.backtrace = parsed["backtrace"]
|
|
70
69
|
msg.env = parsed["env"]
|
|
71
70
|
msg.count = parsed["count"]
|
|
@@ -132,8 +131,10 @@ module Logster
|
|
|
132
131
|
|
|
133
132
|
def merge_similar_message(other)
|
|
134
133
|
self.first_timestamp ||= self.timestamp
|
|
135
|
-
self.timestamp = [self.timestamp,other.timestamp].max
|
|
134
|
+
self.timestamp = [self.timestamp, other.timestamp].max
|
|
135
|
+
|
|
136
136
|
self.count += other.count || 1
|
|
137
|
+
return false if self.count > Logster::MAX_GROUPING_LENGTH
|
|
137
138
|
|
|
138
139
|
other_env = JSON.load JSON.fast_generate other.env
|
|
139
140
|
if Array === self.env
|
|
@@ -141,6 +142,7 @@ module Logster
|
|
|
141
142
|
else
|
|
142
143
|
Array === other_env ? self.env = [self.env, *other_env] : self.env = [self.env, other_env]
|
|
143
144
|
end
|
|
145
|
+
true
|
|
144
146
|
end
|
|
145
147
|
|
|
146
148
|
def self.populate_from_env(env)
|
|
@@ -162,7 +164,7 @@ module Logster
|
|
|
162
164
|
scrubbed = default_env
|
|
163
165
|
request = Rack::Request.new(env)
|
|
164
166
|
params = {}
|
|
165
|
-
request.params.each do |k,v|
|
|
167
|
+
request.params.each do |k, v|
|
|
166
168
|
if k.include? "password"
|
|
167
169
|
params[k] = "[redacted]"
|
|
168
170
|
elsif Array === v
|
|
@@ -172,8 +174,8 @@ module Logster
|
|
|
172
174
|
end
|
|
173
175
|
end
|
|
174
176
|
scrubbed["params"] = params if params.length > 0
|
|
175
|
-
ALLOWED_ENV.map{ |k|
|
|
176
|
-
|
|
177
|
+
ALLOWED_ENV.map { |k|
|
|
178
|
+
scrubbed[k] = env[k] if env[k]
|
|
177
179
|
}
|
|
178
180
|
scrubbed
|
|
179
181
|
end
|
|
@@ -188,16 +190,16 @@ module Logster
|
|
|
188
190
|
|
|
189
191
|
def =~(pattern)
|
|
190
192
|
case pattern
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
193
|
+
when Hash
|
|
194
|
+
IgnorePattern.new(nil, pattern).matches? self
|
|
195
|
+
when String
|
|
196
|
+
IgnorePattern.new(pattern, nil).matches? self
|
|
197
|
+
when Regexp
|
|
198
|
+
IgnorePattern.new(pattern, nil).matches? self
|
|
199
|
+
when IgnorePattern
|
|
200
|
+
pattern.matches? self
|
|
199
201
|
else
|
|
200
|
-
|
|
202
|
+
nil
|
|
201
203
|
end
|
|
202
204
|
end
|
|
203
205
|
|
|
@@ -206,48 +208,5 @@ module Logster
|
|
|
206
208
|
def get_timestamp
|
|
207
209
|
(Time.new.to_f * 1000).to_i
|
|
208
210
|
end
|
|
209
|
-
|
|
210
|
-
private
|
|
211
|
-
|
|
212
|
-
def self.env_merge_helper(self_value, other_value)
|
|
213
|
-
other_value = other_value.to_s if Symbol === other_value
|
|
214
|
-
|
|
215
|
-
if (Hash === self_value || self_value.nil?) && (Hash === other_value || other_value.nil?) && (!self_value.nil? || !other_value.nil?)
|
|
216
|
-
# one or both is a hash but not neither -> recurse on the keys
|
|
217
|
-
self_value = {} unless self_value
|
|
218
|
-
other_value = {} unless other_value
|
|
219
|
-
shared_keys = self_value.keys | (other_value.keys rescue [])
|
|
220
|
-
shared_keys.each do |key|
|
|
221
|
-
self_value[key] = env_merge_helper(self_value[key], other_value[key])
|
|
222
|
-
end
|
|
223
|
-
self_value
|
|
224
|
-
elsif self_value.is_a?(Array) && !other_value.is_a?(Array)
|
|
225
|
-
# Already have grouped data, so append to array (it's actually a set)
|
|
226
|
-
self_value << other_value unless self_value.include?(other_value) || self_value.length >= Logster::MAX_GROUPING_LENGTH
|
|
227
|
-
self_value
|
|
228
|
-
elsif !self_value.is_a?(Array)
|
|
229
|
-
if self_value == other_value
|
|
230
|
-
self_value
|
|
231
|
-
else
|
|
232
|
-
[self_value, other_value]
|
|
233
|
-
end
|
|
234
|
-
else
|
|
235
|
-
# They're both arrays.
|
|
236
|
-
# Three cases:
|
|
237
|
-
# self = [1,2,3] and other = [1,2,4] -> make into array of array
|
|
238
|
-
# self = [] and other = [1,2,4] -> make into array of array
|
|
239
|
-
# self = [[1,2,3], [1,2,5]] and other = [1,2,4] -> append to array
|
|
240
|
-
if self_value.length > 0 && self_value[0].is_a?(Array)
|
|
241
|
-
self_value << other_value unless self_value.include?(other_value) || self_value.length >= Logster::MAX_GROUPING_LENGTH
|
|
242
|
-
self_value
|
|
243
|
-
else
|
|
244
|
-
if self_value == other_value
|
|
245
|
-
self_value
|
|
246
|
-
else
|
|
247
|
-
[self_value, other_value]
|
|
248
|
-
end
|
|
249
|
-
end
|
|
250
|
-
end
|
|
251
|
-
end
|
|
252
211
|
end
|
|
253
212
|
end
|
|
@@ -5,7 +5,7 @@ module Logster
|
|
|
5
5
|
PATH_INFO = "PATH_INFO".freeze
|
|
6
6
|
SCRIPT_NAME = "SCRIPT_NAME".freeze
|
|
7
7
|
|
|
8
|
-
def initialize(app, config={})
|
|
8
|
+
def initialize(app, config = {})
|
|
9
9
|
@app = app
|
|
10
10
|
@error_path = Logster.config.subdirectory + '/report_js_error'
|
|
11
11
|
end
|
|
@@ -13,7 +13,6 @@ module Logster
|
|
|
13
13
|
def call(env)
|
|
14
14
|
Thread.current[Logster::Logger::LOGSTER_ENV] = env
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
path = env[PATH_INFO]
|
|
18
17
|
script_name = env[SCRIPT_NAME]
|
|
19
18
|
|
|
@@ -25,7 +24,7 @@ module Logster
|
|
|
25
24
|
Logster.config.current_context.call(env) do
|
|
26
25
|
report_js_error(env)
|
|
27
26
|
end
|
|
28
|
-
return [200,{},["OK"]]
|
|
27
|
+
return [200, {}, ["OK"]]
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
@app.call(env)
|
|
@@ -13,7 +13,7 @@ module Logster
|
|
|
13
13
|
|
|
14
14
|
@logs_path = Logster.config.subdirectory
|
|
15
15
|
@path_regex = Regexp.new("^(#{@logs_path}$)|^(#{@logs_path}(/.*))$")
|
|
16
|
-
@store = Logster.store
|
|
16
|
+
(@store = Logster.store) || raise(ArgumentError.new("store"))
|
|
17
17
|
|
|
18
18
|
@assets_path = File.expand_path("../../../../assets", __FILE__)
|
|
19
19
|
@fileserver = Rack::File.new(@assets_path)
|
|
@@ -46,7 +46,7 @@ module Logster
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
Logster.store.delete(message)
|
|
49
|
-
return [301, {"Location" => "#{@logs_path}/"}, []]
|
|
49
|
+
return [301, { "Location" => "#{@logs_path}/" }, []]
|
|
50
50
|
|
|
51
51
|
elsif resource =~ /\/(un)?protect\/([0-9a-f]+)$/
|
|
52
52
|
off = $1 == "un"
|
|
@@ -59,13 +59,13 @@ module Logster
|
|
|
59
59
|
|
|
60
60
|
if off
|
|
61
61
|
if Logster.store.unprotect(key)
|
|
62
|
-
return [301, {"Location" => "#{@logs_path}/show/#{key}?protected=false"}, []]
|
|
62
|
+
return [301, { "Location" => "#{@logs_path}/show/#{key}?protected=false" }, []]
|
|
63
63
|
else
|
|
64
64
|
return [500, {}, ["Failed"]]
|
|
65
65
|
end
|
|
66
66
|
else
|
|
67
67
|
if Logster.store.protect(key)
|
|
68
|
-
return [301, {"Location" => "#{@logs_path}/show/#{key}?protected=true"}, []]
|
|
68
|
+
return [301, { "Location" => "#{@logs_path}/show/#{key}?protected=true" }, []]
|
|
69
69
|
else
|
|
70
70
|
return [500, {}, ["Failed"]]
|
|
71
71
|
end
|
|
@@ -81,7 +81,7 @@ module Logster
|
|
|
81
81
|
|
|
82
82
|
Logster.store.solve(key)
|
|
83
83
|
|
|
84
|
-
return [301, {"Location" => "#{@logs_path}"}, []]
|
|
84
|
+
return [301, { "Location" => "#{@logs_path}" }, []]
|
|
85
85
|
|
|
86
86
|
elsif resource =~ /\/clear$/
|
|
87
87
|
if env[REQUEST_METHOD] != "POST"
|
|
@@ -100,14 +100,14 @@ module Logster
|
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
if json
|
|
103
|
-
[200, {"Content-Type" => "application/json; charset=utf-8"}, [message.to_json]]
|
|
103
|
+
[200, { "Content-Type" => "application/json; charset=utf-8" }, [message.to_json]]
|
|
104
104
|
else
|
|
105
|
-
preload = preload_json(
|
|
106
|
-
[200, {"Content-Type" => "text/html; charset=utf-8"}, [body(preload)]]
|
|
105
|
+
preload = preload_json("/show/#{key}" => message)
|
|
106
|
+
[200, { "Content-Type" => "text/html; charset=utf-8" }, [body(preload)]]
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
elsif resource == "/"
|
|
110
|
-
[200, {"Content-Type" => "text/html; charset=utf-8"}, [body(preload_json)]]
|
|
110
|
+
[200, { "Content-Type" => "text/html; charset=utf-8" }, [body(preload_json)]]
|
|
111
111
|
|
|
112
112
|
else
|
|
113
113
|
[404, {}, ["Not found"]]
|
|
@@ -134,8 +134,8 @@ module Logster
|
|
|
134
134
|
after: params["after"]
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
if(filter = params["filter"])
|
|
138
|
-
filter = filter.split("_").map{|s| s.to_i}
|
|
137
|
+
if (filter = params["filter"])
|
|
138
|
+
filter = filter.split("_").map { |s| s.to_i }
|
|
139
139
|
opts[:severity] = filter
|
|
140
140
|
end
|
|
141
141
|
|
|
@@ -152,7 +152,7 @@ module Logster
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
json = JSON.generate(payload)
|
|
155
|
-
[200, {"Content-Type" => "application/json"}, [json]]
|
|
155
|
+
[200, { "Content-Type" => "application/json" }, [json]]
|
|
156
156
|
end
|
|
157
157
|
|
|
158
158
|
def parse_regex(string)
|
|
@@ -169,20 +169,20 @@ module Logster
|
|
|
169
169
|
end
|
|
170
170
|
end
|
|
171
171
|
|
|
172
|
-
def preload_json(extra={})
|
|
172
|
+
def preload_json(extra = {})
|
|
173
173
|
values = {}
|
|
174
174
|
values.merge!(extra)
|
|
175
175
|
end
|
|
176
176
|
|
|
177
|
-
def css(name, attrs={})
|
|
178
|
-
attrs = attrs.map do |k,v|
|
|
177
|
+
def css(name, attrs = {})
|
|
178
|
+
attrs = attrs.map do |k, v|
|
|
179
179
|
"#{k}='#{v}'"
|
|
180
180
|
end.join(" ")
|
|
181
181
|
|
|
182
182
|
"<link rel='stylesheet' type='text/css' href='#{@logs_path}/stylesheets/#{name}' #{attrs}>"
|
|
183
183
|
end
|
|
184
184
|
|
|
185
|
-
def script(prod, dev=nil)
|
|
185
|
+
def script(prod, dev = nil)
|
|
186
186
|
name = ENV['DEBUG_JS'] == "1" && dev ? dev : prod
|
|
187
187
|
"<script src='#{@logs_path}/javascript/#{name}'></script>"
|
|
188
188
|
end
|