MrMurano 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/MrMurano/logs.rb +53 -15
- data/lib/MrMurano/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbf6540edd42b5a6cac68bb92b3f18f69cf0e90e
|
4
|
+
data.tar.gz: 311ff88459a51b3af06604d89d5c9b58f32b849f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d01eaf47965c58e51cd502e5a6268d799a5cc96d4eca6bc4930a4dbe555519114ecae0c8483c1876bfbf3bc29cde1ead1cb5a91ccf307d5580c86f0fec7df5ba
|
7
|
+
data.tar.gz: 8b2b715ba8955ad9ea54c02ad9a5acbc8781f7f70129929f7a295d6b17a5bd53893934f190ef79d1803f633e679a2ccfafbd3d201bde83174ff183ec7af60dcf
|
data/lib/MrMurano/logs.rb
CHANGED
@@ -25,34 +25,72 @@ command :logs do |c|
|
|
25
25
|
if ret.kind_of?(Hash) and ret.has_key?('items') then
|
26
26
|
ret['items'].reverse.each do |line|
|
27
27
|
curtime = ""
|
28
|
+
if line.kind_of?(String) then
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
line.sub!(/^\[[^\]]*\]/) {|m| m.color(:red).background(:aliceblue)}
|
31
|
+
line.sub!(/\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d+)(?:\+\d\d:\d\d)/) {|m|
|
32
|
+
if options.localtime then
|
33
|
+
m = DateTime.parse(m).to_time.localtime.to_datetime.iso8601(3)
|
34
|
+
end
|
35
|
+
curtime = m
|
36
|
+
m.color(:blue)
|
37
|
+
}
|
38
|
+
|
39
|
+
line.gsub!(/\{(?>[^}{]+|\g<0>)*\}/m) do |m|
|
40
|
+
if options.pretty then
|
41
|
+
js = JSON.parse(m, {:allow_nan=>true, :create_additions=>false})
|
42
|
+
ret = JSON.pretty_generate(js).to_s
|
43
|
+
ret[0] = ret[0].color(:magenta)
|
44
|
+
ret[-1] = ret[-1].color(:magenta)
|
45
|
+
ret
|
46
|
+
else
|
47
|
+
m.sub!(/^{/){|ml| ml.color(:magenta)}
|
48
|
+
m.sub!(/}$/){|ml| ml.color(:magenta)}
|
49
|
+
m
|
50
|
+
end
|
33
51
|
end
|
34
|
-
curtime = m
|
35
|
-
m.color(:blue)
|
36
|
-
}
|
37
52
|
|
38
|
-
|
53
|
+
out = line
|
54
|
+
|
55
|
+
elsif line.kind_of?(Hash) then
|
56
|
+
line = Hash.transform_keys_to_symbols(line)
|
57
|
+
out=""
|
58
|
+
|
59
|
+
out << "[#{line[:subject]}]".color(:red).background(:aliceblue)
|
60
|
+
out << " "
|
61
|
+
if options.localtime then
|
62
|
+
curtime = Time.at(line[:timestamp]).localtime.to_datetime.iso8601(3)
|
63
|
+
else
|
64
|
+
curtime = Time.at(line[:timestamp]).to_datetime.iso8601(3)
|
65
|
+
end
|
66
|
+
out << curtime.color(:blue)
|
67
|
+
out << ":"
|
68
|
+
out << "\n---------\nrequest:"
|
39
69
|
if options.pretty then
|
40
|
-
|
41
|
-
ret = JSON.pretty_generate(js).to_s
|
70
|
+
ret = JSON.pretty_generate(line[:data][:request]).to_s
|
42
71
|
ret[0] = ret[0].color(:magenta)
|
43
72
|
ret[-1] = ret[-1].color(:magenta)
|
44
|
-
ret
|
73
|
+
out << ret
|
45
74
|
else
|
46
|
-
|
47
|
-
m.sub!(/}$/){|ml| ml.color(:magenta)}
|
48
|
-
m
|
75
|
+
out << line[:data][:request].to_json
|
49
76
|
end
|
77
|
+
out << "\n---------\nresponse:"
|
78
|
+
if options.pretty then
|
79
|
+
ret = JSON.pretty_generate(line[:data][:response]).to_s
|
80
|
+
ret[0] = ret[0].color(:magenta)
|
81
|
+
ret[-1] = ret[-1].color(:magenta)
|
82
|
+
out << ret
|
83
|
+
else
|
84
|
+
out << line[:data][:response].to_json
|
85
|
+
end
|
86
|
+
|
50
87
|
end
|
51
88
|
|
52
89
|
if curtime > lasttime then
|
53
90
|
lasttime = curtime
|
54
|
-
puts
|
91
|
+
puts out
|
55
92
|
end
|
93
|
+
|
56
94
|
end
|
57
95
|
else
|
58
96
|
say_error "Couldn't get logs: #{ret}"
|
data/lib/MrMurano/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: MrMurano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Conrad Tadpol Tilstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|