myslog 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/myslog.rb +13 -13
- data/myslog.gemspec +1 -1
- metadata +3 -2
data/lib/myslog.rb
CHANGED
@@ -66,21 +66,21 @@ class MySlog
|
|
66
66
|
end
|
67
67
|
elsif record.start_with? "#"
|
68
68
|
|
69
|
-
|
70
|
-
elems
|
71
|
-
|
72
|
-
response[:date] = Time.parse(record[8..-1].strip)
|
69
|
+
elems = record[2..-1].strip().split " "
|
70
|
+
if elems.size == 3 && elems[0] == "Time:"
|
71
|
+
response[:date] = Time.parse(elems[1]+" "+elems[2])
|
73
72
|
else
|
74
|
-
elems.
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
73
|
+
elems.each_with_index do |elem,i|
|
74
|
+
if elem.include?(":") && !elems[i+1].include?(":")
|
75
|
+
value = elems[i+1]
|
76
|
+
case value
|
77
|
+
when /^\d+$/
|
78
|
+
value = value.to_i
|
79
|
+
when /^\d+\.\d+(?:e[-+]\d+)?$/
|
80
|
+
value = value.to_f
|
81
|
+
end
|
82
|
+
response[elem[0...-1].downcase.to_sym] = value
|
82
83
|
end
|
83
|
-
response[name.downcase.to_sym] = value
|
84
84
|
end
|
85
85
|
end
|
86
86
|
else
|
data/myslog.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myslog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -70,3 +70,4 @@ summary: MySQL slow query parser.
|
|
70
70
|
test_files:
|
71
71
|
- spec/myslog.rb
|
72
72
|
- spec/spec_helper.rb
|
73
|
+
has_rdoc:
|