logster 2.3.2 → 2.3.3
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/CHANGELOG.md +4 -0
- data/assets/javascript/client-app.js +10 -9
- data/client-app/app/lib/utilities.js +9 -3
- data/client-app/tests/integration/components/env-tab-test.js +16 -3
- data/lib/logster/message.rb +7 -0
- data/lib/logster/version.rb +1 -1
- data/test/logster/test_message.rb +16 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 38711e83a2c613a56be83f149d23feec68c67e0f7ba8381d950f0a475b1cb11b
|
|
4
|
+
data.tar.gz: f22d585c57bc5e36de09b5dd88f169fe3a1f9d7b6a96284cca224f4c0cf44e0c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fc179965f5548747100df69af1f1f03b5bd7e6ab0138e38209d0b09b444993a286e574f51f47576c4c1083a0bb944b8b2f2580b26721ef246dc42c263b7d5d79
|
|
7
|
+
data.tar.gz: ed616d71148b2294550a643f1ec34eb2322c9e06b92c744cf1fab47a7633565aeaace44ef0241015f3773684f90a57089e2900c1b545a7f70ff2888924f171da
|
data/CHANGELOG.md
CHANGED
|
@@ -104,23 +104,24 @@ function a(){var e=document.getElementById("preloaded-data").dataset
|
|
|
104
104
|
t=Em.$.extend(JSON.parse(e.preloaded),{rootPath:e.rootPath}),n=!0}var s={get:function(e){return n||a(),Em.get(t,e)}}
|
|
105
105
|
e.default=s}),define("client-app/lib/utilities",["exports","@babel/runtime/helpers/esm/typeof","client-app/lib/preload"],function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.escapeHtml=o,e.ajax=l,e.preloadOrAjax=function(e,t){var a=n.default.get(e.replace(".json",""))
|
|
106
106
|
return a?Em.RSVP.resolve(a):l(e,t)},e.updateHiddenProperty=function(e){a=e},e.isHidden=u,e.increaseTitleCount=function(e){if(!u())return
|
|
107
|
-
s=s||document.title,i=i||0,i+=e,document.title="".concat(s," (").concat(i,")")},e.resetTitleCount=function(){i=0,document.title=s||document.title},e.formatTime=function(
|
|
108
|
-
t=n.diff(a.startOf("day"))>0?n.format("h:mm a"):n.diff(a.startOf("week"))>0?n.format("dd h:mm a"):n.diff(a.startOf("year"))>0?n.format("D MMM h:mm a"):n.format("D MMM YY")
|
|
109
|
-
return t},e.buildArrayString=c,e.buildHashString=function e(a,s){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]
|
|
107
|
+
s=s||document.title,i=i||0,i+=e,document.title="".concat(s," (").concat(i,")")},e.resetTitleCount=function(){i=0,document.title=s||document.title},e.formatTime=c,e.buildArrayString=d,e.buildHashString=function e(a,s){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]
|
|
110
108
|
if(!a)return""
|
|
111
109
|
var r=[]
|
|
112
110
|
var l=[]
|
|
113
111
|
var u=n.default.get("env_expandable_keys")||[]
|
|
114
112
|
_.each(a,function(e,n){if(null===e)r.push("null")
|
|
115
113
|
else if("[object Array]"===Object.prototype.toString.call(e)){var a=""
|
|
116
|
-
a=-1!==u.indexOf(n)&&!s&&-1===i.indexOf(n)&&e.length>3?"".concat(o(e[0]),', <a class="expand-list" data-key=').concat(n,">").concat(e.length-1," more</a>"):
|
|
114
|
+
a=-1!==u.indexOf(n)&&!s&&-1===i.indexOf(n)&&e.length>3?"".concat(o(e[0]),', <a class="expand-list" data-key=').concat(n,">").concat(e.length-1," more</a>"):d(e),r.push("<tr><td>"+o(n)+"</td><td>"+a+"</td></tr>")}else if("object"===(0,t.default)(e))l.push(n)
|
|
115
|
+
else if("time"===n&&"number"==typeof e){var p=moment(e).format(),f=c(e)
|
|
116
|
+
r.push('<tr title="'.concat(p,'"><td>').concat(n,"</td><td>").concat(f,"</td></tr>"))}else r.push("<tr><td>".concat(o(n),"</td><td>").concat(o(e),"</td></tr>"))})
|
|
117
117
|
_.size(l)>0&&_.each(l,function(t){var n=a[t]
|
|
118
118
|
r.push("<tr><td></td><td><table>"),r.push("<td>"+o(t)+"</td><td>"+e(n,!0)+"</td>"),r.push("</table></td></tr>")})
|
|
119
|
-
var
|
|
120
|
-
return"<table class='"+
|
|
119
|
+
var p=s?"":"env-table"
|
|
120
|
+
return"<table class='"+p+"'>"+r.join("\n")+"</table>"}
|
|
121
121
|
var a,s,i,r={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}
|
|
122
|
-
function o(e){return String(e).replace(/[&<>"'\/]/g,function(e){return r[e]})}function l(e,t){return(t=t||{}).headers=t.headers||{},t.headers["X-SILENCE-LOGGER"]=!0,Em.$.ajax(n.default.get("rootPath")+e,t)}function u(){return void 0!==a?document[a]:!document.hasFocus}function c(e){var t=
|
|
123
|
-
return
|
|
122
|
+
function o(e){return String(e).replace(/[&<>"'\/]/g,function(e){return r[e]})}function l(e,t){return(t=t||{}).headers=t.headers||{},t.headers["X-SILENCE-LOGGER"]=!0,Em.$.ajax(n.default.get("rootPath")+e,t)}function u(){return void 0!==a?document[a]:!document.hasFocus}function c(e){var t=moment(e),n=moment()
|
|
123
|
+
return t.diff(n.startOf("day"))>0?t.format("h:mm a"):t.diff(n.startOf("week"))>0?t.format("dd h:mm a"):t.diff(n.startOf("year"))>0?t.format("D MMM h:mm a"):t.format("D MMM YY")}function d(e){var t=[]
|
|
124
|
+
return e.forEach(function(e){null===e?t.push("null"):"[object Array]"===Object.prototype.toString.call(e)?t.push(d(e)):t.push(o(e.toString()))}),"["+t.join(", ")+"]"}}),define("client-app/models/message-collection",["exports","client-app/lib/utilities","client-app/models/message"],function(e,t,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
124
125
|
var a=Em.Object.extend({messages:Em.A(),currentMessage:null,total:0,solve:function(e){var t=this
|
|
125
126
|
e.solve().then(function(){t.reload()})},destroy:function(e){var t=this.get("messages"),n=t.indexOf(e)
|
|
126
127
|
e.destroy(),e.set("selected",!1),this.set("total",this.get("total")-1),this.get("messages").removeObject(e),n>0?((e=t[n-1]).set("selected",!0),this.set("currentMessage",e)):this.get("total")>0?((e=t[0]).set("selected",!0),this.set("currentMessage",e)):this.reload()},load:function(e){var n=this
|
|
@@ -194,4 +195,4 @@ var t=Ember.HTMLBars.template({id:"K64jJk76",block:'{"symbols":[],"statements":[
|
|
|
194
195
|
e.default=t}),define("client-app/templates/show",["exports"],function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0
|
|
195
196
|
var t=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"}})
|
|
196
197
|
e.default=t}),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(decodeURIComponent(t))}
|
|
197
|
-
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:"
|
|
198
|
+
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:"v2.3.2+3ee689f3"})
|
|
@@ -125,9 +125,15 @@ export function buildHashString(hash, recurse, expanded = []) {
|
|
|
125
125
|
} else if (typeof v === "object") {
|
|
126
126
|
hashes.push(k);
|
|
127
127
|
} else {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
if (k === "time" && typeof v === "number") {
|
|
129
|
+
const title = moment(v).format();
|
|
130
|
+
const time = formatTime(v);
|
|
131
|
+
buffer.push(`<tr title="${title}"><td>${k}</td><td>${time}</td></tr>`);
|
|
132
|
+
} else {
|
|
133
|
+
buffer.push(
|
|
134
|
+
`<tr><td>${escapeHtml(k)}</td><td>${escapeHtml(v)}</td></tr>`
|
|
135
|
+
);
|
|
136
|
+
}
|
|
131
137
|
}
|
|
132
138
|
});
|
|
133
139
|
|
|
@@ -5,8 +5,11 @@ import hbs from "htmlbars-inline-precompile";
|
|
|
5
5
|
import Message from "client-app/models/message";
|
|
6
6
|
import { init } from "client-app/lib/preload";
|
|
7
7
|
|
|
8
|
+
const time1 = new Date("2010-01-01T01:00:00").getTime();
|
|
9
|
+
const time2 = new Date("2015-01-01T01:00:00").getTime();
|
|
10
|
+
|
|
8
11
|
const message = Message.create({
|
|
9
|
-
env: [{ a: "aa", b: "bb" }, { c: "cc", d: "dd" }]
|
|
12
|
+
env: [{ a: "aa", b: "bb", time: time1 }, { c: "cc", d: "dd", time: time2 }]
|
|
10
13
|
});
|
|
11
14
|
|
|
12
15
|
const message2 = Message.create({
|
|
@@ -41,9 +44,14 @@ module("Integration | Component | env-tab", function(hooks) {
|
|
|
41
44
|
"shows the current over the total number of env objects"
|
|
42
45
|
);
|
|
43
46
|
let trs = findAll("tr");
|
|
44
|
-
assert.equal(trs.length,
|
|
47
|
+
assert.equal(trs.length, 3);
|
|
45
48
|
assert.equal(reduceToContent(trs[0]), "a: aa", "has the right content");
|
|
46
49
|
assert.equal(reduceToContent(trs[1]), "b: bb", "has the right content");
|
|
50
|
+
assert.equal(
|
|
51
|
+
reduceToContent(trs[2]),
|
|
52
|
+
"time: 1 Jan 10",
|
|
53
|
+
"has the right content"
|
|
54
|
+
);
|
|
47
55
|
|
|
48
56
|
const buttons = findAll("button.nav-btn");
|
|
49
57
|
// at first page, you can't go back
|
|
@@ -76,9 +84,14 @@ module("Integration | Component | env-tab", function(hooks) {
|
|
|
76
84
|
);
|
|
77
85
|
|
|
78
86
|
const trs = findAll("tr");
|
|
79
|
-
assert.equal(trs.length,
|
|
87
|
+
assert.equal(trs.length, 3);
|
|
80
88
|
assert.equal(reduceToContent(trs[0]), "c: cc", "has the right content");
|
|
81
89
|
assert.equal(reduceToContent(trs[1]), "d: dd", "has the right content");
|
|
90
|
+
assert.equal(
|
|
91
|
+
reduceToContent(trs[2]),
|
|
92
|
+
"time: 1 Jan 15",
|
|
93
|
+
"has the right content"
|
|
94
|
+
);
|
|
82
95
|
|
|
83
96
|
// at last page, you can't go forward but you can go back
|
|
84
97
|
assert.notOk(buttons[0].disabled, "back buttons are not disabled");
|
data/lib/logster/message.rb
CHANGED
|
@@ -141,6 +141,13 @@ module Logster
|
|
|
141
141
|
return false if self.count > Logster::MAX_GROUPING_LENGTH
|
|
142
142
|
|
|
143
143
|
other_env = JSON.load JSON.fast_generate other.env
|
|
144
|
+
if Hash === other_env && !other_env.key?("time")
|
|
145
|
+
other_env["time"] = other.timestamp
|
|
146
|
+
end
|
|
147
|
+
if Hash === self.env && !self.env.key?("time")
|
|
148
|
+
self.env["time"] = self.first_timestamp
|
|
149
|
+
end
|
|
150
|
+
|
|
144
151
|
if Array === self.env
|
|
145
152
|
Array === other_env ? self.env.concat(other_env) : self.env << other_env
|
|
146
153
|
else
|
data/lib/logster/version.rb
CHANGED
|
@@ -23,6 +23,20 @@ class TestMessage < MiniTest::Test
|
|
|
23
23
|
assert({ "a" => "2", "c" => "3" } <= msg1.env[1])
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
def test_merge_adds_timestamp_to_env
|
|
27
|
+
time1 = Time.new(2010, 1, 1, 1, 1).to_i
|
|
28
|
+
msg1 = Logster::Message.new(0, '', 'test', time1)
|
|
29
|
+
msg1.env = { a: "aa", b: "bb" }
|
|
30
|
+
|
|
31
|
+
time2 = Time.new(2011, 1, 1, 1, 1).to_i
|
|
32
|
+
msg2 = Logster::Message.new(0, '', 'test', time2)
|
|
33
|
+
msg2.env = { e: "ee", f: "ff" }
|
|
34
|
+
|
|
35
|
+
msg1.merge_similar_message(msg2)
|
|
36
|
+
assert_equal(time1, msg1.env[0]["time"])
|
|
37
|
+
assert_equal(time2, msg1.env[1]["time"])
|
|
38
|
+
end
|
|
39
|
+
|
|
26
40
|
def test_merge_messages_both_with_array_envs
|
|
27
41
|
msg1 = Logster::Message.new(0, '', 'test', 10)
|
|
28
42
|
msg1.env = [{ a: "aa", b: "bb" }, { c: "cc", d: "dd" }]
|
|
@@ -49,8 +63,8 @@ class TestMessage < MiniTest::Test
|
|
|
49
63
|
msg1.merge_similar_message(msg2)
|
|
50
64
|
|
|
51
65
|
assert_equal(msg1.env.size, 3)
|
|
52
|
-
assert_equal(msg1.env.map(&:keys).flatten(1).map(&:to_s), %w{a b c d e f})
|
|
53
|
-
assert_equal(msg1.env.map(&:values).flatten(1).map(&:to_s), %w{aa bb cc dd ee ff})
|
|
66
|
+
assert_equal(msg1.env.map(&:keys).flatten(1).map(&:to_s), %w{a b c d e f time})
|
|
67
|
+
assert_equal(msg1.env.map(&:values).flatten(1).map(&:to_s), %w{aa bb cc dd ee ff 20})
|
|
54
68
|
end
|
|
55
69
|
|
|
56
70
|
def test_adds_application_version
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logster
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.3.
|
|
4
|
+
version: 2.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- UI for viewing logs in Rack
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-08
|
|
11
|
+
date: 2019-10-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|