aix-errlog 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aix/errlog/errlog.rb +30 -47
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a5bf9f5032e8678c2743abee0bc82207e79fe58ab891a8e54fa86cfec4d73b5
|
4
|
+
data.tar.gz: 58d752d88e8ec4c746b220185d7d4693bdd7422d040f95a6a3b5ac7a3f496d57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc7ff6b6b189b7aa3bee944d81371dd5cfb878d900fdbcb44386162c0d9ec60ba707816374ab9e140cadff5b8ec0bfdd9746f5f31e5acf6d80b3193279a96d3b
|
7
|
+
data.tar.gz: 967c2fa36918ad19addb60f2c6183c8d4d0a993c896eed7c7dd785fbe9dc206f36a3067b573288f5301d067adb2c582e397e59c03cf4da3fe10778f77d87e0ef
|
data/lib/aix/errlog/errlog.rb
CHANGED
@@ -46,7 +46,7 @@ module AIX
|
|
46
46
|
# require 'aix/errlog'
|
47
47
|
#
|
48
48
|
# AIX::Errlog.open do |log|
|
49
|
-
# log.forward_each(
|
49
|
+
# log.forward_each(log.match {
|
50
50
|
# label.include?('KILL') & (
|
51
51
|
# (
|
52
52
|
# (sequence > 1000) &
|
@@ -142,15 +142,11 @@ module AIX
|
|
142
142
|
# Enumerate log Entry objects in forward order (default is reverse). If
|
143
143
|
# no block is given, returns an enumerator.
|
144
144
|
#
|
145
|
-
#
|
146
|
-
#
|
147
|
-
#
|
148
|
-
# match takes a Match object, which specifies which entries to match.
|
145
|
+
# The single option is a matcher. It specifies a match if the passed in
|
146
|
+
# value is a Match, or a sequence ID otherwise.
|
149
147
|
#
|
150
|
-
#
|
151
|
-
#
|
152
|
-
# stopped position, if #find_sequence or #find_first have already been
|
153
|
-
# called).
|
148
|
+
# sequence specifies the sequence ID to start with. It will be included
|
149
|
+
# in the results if specifed. The match is a more complex matcher.
|
154
150
|
#
|
155
151
|
# An active enumerator can not be nested within another active enumerator,
|
156
152
|
# including the block form of this. If you invoke any of the #each_
|
@@ -161,30 +157,24 @@ module AIX
|
|
161
157
|
# Warning: if the sequence does not exist (which is common when error logs
|
162
158
|
# are cleaned), no entries will be returned, even if they follow the
|
163
159
|
# sequence ID. If you want all entries based on their sequence number,
|
164
|
-
# use
|
160
|
+
# use a Match instead. You're usually better off using the timestamp
|
165
161
|
# instead of sequence number, because the sequence number is 32 bits and
|
166
162
|
# might wrap.
|
167
|
-
def forward_each(
|
168
|
-
|
169
|
-
|
170
|
-
return to_enum(:forward_each, match: match, sequence: sequence) unless block_given?
|
163
|
+
def forward_each(matcher=nil, &block)
|
164
|
+
return to_enum(:forward_each, matcher) unless block_given?
|
171
165
|
set_direction :forward
|
172
|
-
each(
|
166
|
+
each(matcher, &block)
|
173
167
|
end
|
174
168
|
|
175
169
|
##
|
176
170
|
# Enumerate log Entry objects in reverse order (default is reverse). If
|
177
171
|
# no block is given, returns an enumerator.
|
178
172
|
#
|
179
|
-
#
|
180
|
-
#
|
181
|
-
#
|
182
|
-
# match takes a Match object, which specifies which entries to match.
|
173
|
+
# The single option is a matcher. It specifies a match if the passed in
|
174
|
+
# value is a Match, or a sequence ID otherwise.
|
183
175
|
#
|
184
|
-
#
|
185
|
-
#
|
186
|
-
# stopped position, if #find_sequence or #find_first have already been
|
187
|
-
# called).
|
176
|
+
# sequence specifies the sequence ID to start with. It will be included
|
177
|
+
# in the results if specifed. The match is a more complex matcher.
|
188
178
|
#
|
189
179
|
# An active enumerator can not be nested within another active enumerator,
|
190
180
|
# including the block form of this. If you invoke any of the #each_
|
@@ -195,15 +185,13 @@ module AIX
|
|
195
185
|
# Warning: if the sequence does not exist (which is common when error logs
|
196
186
|
# are cleaned), no entries will be returned, even if they follow the
|
197
187
|
# sequence ID. If you want all entries based on their sequence number,
|
198
|
-
# use
|
188
|
+
# use a Match instead. You're usually better off using the timestamp
|
199
189
|
# instead of sequence number, because the sequence number is 32 bits and
|
200
190
|
# might wrap.
|
201
|
-
def reverse_each(
|
202
|
-
|
203
|
-
|
204
|
-
return to_enum(:reverse_each, match: match, sequence: sequence) unless block_given?
|
191
|
+
def reverse_each(matcher=nil, &block)
|
192
|
+
return to_enum(:reverse_each, matcher) unless block_given?
|
205
193
|
set_direction :reverse
|
206
|
-
each(
|
194
|
+
each(matcher, &block)
|
207
195
|
end
|
208
196
|
|
209
197
|
##
|
@@ -283,15 +271,11 @@ module AIX
|
|
283
271
|
# Enumerate log entries in the order set in #set_direction (default is
|
284
272
|
# reverse).
|
285
273
|
#
|
286
|
-
#
|
287
|
-
#
|
288
|
-
#
|
289
|
-
# match takes a Match object, which specifies which entries to match.
|
274
|
+
# The single option is a matcher. It specifies a match if the passed in
|
275
|
+
# value is a Match, or a sequence ID otherwise.
|
290
276
|
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
# stopped position, if #find_sequence or #find_first have already been
|
294
|
-
# called).
|
277
|
+
# sequence specifies the sequence ID to start with. It will be included
|
278
|
+
# in the results if specifed. The match is a more complex matcher.
|
295
279
|
#
|
296
280
|
# An active enumerator can not be nested within another active enumerator,
|
297
281
|
# including the block form of this. If you invoke any of the #each_
|
@@ -302,12 +286,12 @@ module AIX
|
|
302
286
|
# Warning: if the sequence does not exist (which is common when error logs
|
303
287
|
# are cleaned), no entries will be returned, even if they follow the
|
304
288
|
# sequence ID. If you want all entries based on their sequence number,
|
305
|
-
# use
|
289
|
+
# use a Match instead. You're usually better off using the timestamp
|
306
290
|
# instead of sequence number, because the sequence number is 32 bits and
|
307
291
|
# might wrap.
|
308
292
|
#
|
309
293
|
# The user-facing entry points to this are #forward_each and #reverse_each
|
310
|
-
def each(
|
294
|
+
def each(matcher=nil)
|
311
295
|
# Does not return an enumerator, because this will always be called with
|
312
296
|
# an active block
|
313
297
|
|
@@ -315,14 +299,13 @@ module AIX
|
|
315
299
|
raise Errors::EnumeratorError if @enum_active
|
316
300
|
@enum_active = true
|
317
301
|
|
318
|
-
if
|
319
|
-
entry =
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
entry = find_first(match)
|
302
|
+
if matcher
|
303
|
+
entry =
|
304
|
+
if matcher.is_a? Match
|
305
|
+
find_first(matcher)
|
306
|
+
else
|
307
|
+
find_sequence(matcher)
|
308
|
+
end
|
326
309
|
return if entry.nil?
|
327
310
|
yield entry
|
328
311
|
end
|