groonga-log 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c2b0dd7415f688f09579a0fb4752211d62544e1d
4
- data.tar.gz: 903b02ac19642629d43cf10a3cd7d8e71ed55e08
2
+ SHA256:
3
+ metadata.gz: 25c1995a063dec899eb5fa204533eb9df494b2dd2cde06e4abb05cc1580ae0cc
4
+ data.tar.gz: 641bb221339794c6d122b103b8c93a8920277690672d71e5a101ac3c1eb39764
5
5
  SHA512:
6
- metadata.gz: e02339c0d2717f2fb064cb3ec61e6c3d9388e8f191a5e03d5efd799b156191a1b3f34982a2d1416f0e5bf2423e662ba635204ae612010753d0ca9ab6fab38cf0
7
- data.tar.gz: 7d803a6634d8e058f2717935064977dd57e90933a5f1a27be8190ec7888d3a031fc119d945ff31ef19ea1a7678f7ab476258cb8e9379839e2e5d209e1087339a
6
+ metadata.gz: 95efa5d957d1837bab8b4bd6a0c96fdeeafeb9f8fc823f8588d9feb80fcc6f401394b6ddedef4407b7691d8ba7eee772c4d2d071129c633b7c4e72b442d99d33
7
+ data.tar.gz: a7619a5354f6651ab6ef0f214ca0f87792927139dfd18b2f245ffab0cba82393dffcf7691a553a3a88ec79d6eff9bb8fa45f63ba88b7803434948c0958e69141
@@ -1,5 +1,15 @@
1
1
  # News
2
2
 
3
+ ## 0.1.3: 2018-08-30
4
+
5
+ ### Improvements
6
+
7
+ * Added support for ignoring broken lines.
8
+
9
+ * Added support for Mroonga style log.
10
+
11
+ * Added support for both process ID and thread ID case.
12
+
3
13
  ## 0.1.2: 2018-02-04
4
14
 
5
15
  ### Improvements
@@ -18,6 +18,7 @@ module GroongaLog
18
18
  class Entry < Struct.new(:timestamp,
19
19
  :log_level,
20
20
  :pid,
21
+ :thread_id,
21
22
  :message)
22
23
  end
23
24
  end
@@ -23,10 +23,11 @@ module GroongaLog
23
23
  class Parser
24
24
  PATTERN =
25
25
  /\A(?<year>\d{4})-(?<month>\d\d)-(?<day>\d\d)
26
- \ (?<hour>\d\d):(?<minute>\d\d):(?<second>\d\d)\.(?<micro_second>\d+)
27
- \|(?<log_level>.)
28
- \|(?:(?<pid>\d+):)?
29
- \ (?<message>[^\r\n]*)/x
26
+ \ (?<hour>\d\d):(?<minute>\d\d):(?<second>\d\d)\.(?<micro_second>\d+)\|
27
+ (?<log_level>.)\|
28
+ (?:(?<pid>\d+)[|:])?
29
+ (?:(?<thread_id>[\da-fA-F]+)[|:])?
30
+ \ ?(?<message>[^\r\n]*)/x
30
31
  PATH_TIMESTAMP_PATTERN = /(\d{4})-(\d{2})-(\d{2})-
31
32
  (\d{2})-(\d{2})-(\d{2})-(\d{6})
32
33
  (?:\.(?:gz|zip))?\z/xi
@@ -68,22 +69,25 @@ module GroongaLog
68
69
  next unless line.valid_encoding?
69
70
  end
70
71
 
71
- m = PATTERN.match(line)
72
+ match_data = PATTERN.match(line)
73
+ next if match_data.nil?
72
74
 
73
75
  entry = Entry.new
74
76
 
75
- year = m["year"].to_i
76
- month = m["month"].to_i
77
- day = m["day"].to_i
78
- hour = m["hour"].to_i
79
- minute = m["minute"].to_i
80
- second = m["second"].to_i
81
- micro_second = m["micro_second"].to_i
77
+ year = Integer(match_data[:year], 10)
78
+ month = Integer(match_data[:month], 10)
79
+ day = Integer(match_data[:day], 10)
80
+ hour = Integer(match_data[:hour], 10)
81
+ minute = Integer(match_data[:minute], 10)
82
+ second = Integer(match_data[:second], 10)
83
+ micro_second = Integer(match_data[:micro_second], 10)
82
84
  entry.timestamp = Time.local(year, month, day,
83
85
  hour, minute, second, micro_second)
84
- entry.log_level = log_level_to_symbol(m["log_level"])
85
- entry.pid = m["pid"].to_i if m["pid"]
86
- entry.message = m["message"]
86
+ entry.log_level = log_level_to_symbol(match_data[:log_level])
87
+ pid = match_data[:pid]
88
+ entry.pid = Integer(pid, 10) if pid
89
+ entry.thread_id = match_data[:thread_id]
90
+ entry.message = match_data[:message]
87
91
  yield entry
88
92
  end
89
93
  end
@@ -1,3 +1,3 @@
1
1
  module GroongaLog
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Horimoto Yasuhiro
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-02-04 00:00:00.000000000 Z
12
+ date: 2018-08-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: archive-zip
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  requirements: []
115
115
  rubyforge_project:
116
- rubygems_version: 2.5.2.2
116
+ rubygems_version: 3.0.0.beta1
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: Groonga-log is a collection of library and tools to process [Groonga](http://groonga.org/)'s