teLogger 0.1.0 → 0.2.0

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
2
  SHA256:
3
- metadata.gz: 7919230720df3483a2140226524bde04ad0da1981a6dc612ddf0c1b9c8adfe95
4
- data.tar.gz: db1fa0e3029d48c66bfc56c41cd93a56b8d3c20ab69c2dac09fb870e1114b031
3
+ metadata.gz: c9eaf21efb89f938d0daef33103857258ce7dd3f7815b72edd714f5c095b605d
4
+ data.tar.gz: 3f0c495afb2ea11978cfb13303405c1ecc2a12e33384c4ee8b68cddfe753f38e
5
5
  SHA512:
6
- metadata.gz: 6bccfe28dd331dc3a5e594c7d36c8ddf2ba3449b9702dab305cf6694fa0be159208e73950f0d963728fb5fd1de847d528e96964ba88ce286c7c64f487608820d
7
- data.tar.gz: bac3ec9366528a8a6d1dc12056bb6c0ffc0e6432cc4b9d1b2e800c1671062a9a6293e07b52e7728a6fc280801b7a0d688638e5108b0e964eaf522c5f694c5884
6
+ metadata.gz: b161a30047b4dc9923b4ef8bfc4860efac11a7a0ecfc48086b8106af5ce08004c5a9dfcd3a2c069105373414f1c6f4374df6035daad7cc02152d6056ad07e9b9
7
+ data.tar.gz: df022a9edf5ab87e6a821da7add3092c9d5e3b31c0cb60e1262676c9b6fc09e3bd3fea7881ee1ab2e848e6e1183729ff03962794761eacb4358fbf33ceec81d3
@@ -0,0 +1,4 @@
1
+ ---
2
+ teLogger:
3
+ - :version: 0.1.0
4
+ :timestamp: 1654445209.1001852
@@ -144,25 +144,6 @@ module TeLogger
144
144
  alias_method :on_all_except, :on_all_tags_except
145
145
  alias_method :all_on_except, :on_all_tags_except
146
146
 
147
- #
148
- # :method: clear_exceptions
149
- #
150
- # Clear the exception list. All exampted tags given either by #off_all_tags_except or #on_all_tags_except
151
- # shall be reset
152
- #
153
- def clear_exceptions
154
- @exception.clear
155
- end
156
-
157
- #
158
- # :method: remove_from_exception
159
- #
160
- # Remote a set of tags from the exception list
161
- #
162
- def remove_from_exception(*tags)
163
- @exception.delete_if { |e| tags.include?(e) }
164
- end
165
-
166
147
  #
167
148
  # :method: method_missing
168
149
  #
@@ -320,34 +301,6 @@ module TeLogger
320
301
  @include_caller = true
321
302
  end
322
303
 
323
- ## detect if the prompt should be to env or file
324
- #def self.init(out = STDOUT)
325
- # if is_dev?
326
- # Tlogger.new(out)
327
- # else
328
- # path = ENV["TLOGGER_FILE_PATH"]
329
- # if path.nil? or path.empty?
330
- # Tlogger.new(nil)
331
- # else
332
- # path = [path] if not path.is_a?(Array)
333
- # Tlogger.new(*path)
334
- # end
335
- # end
336
- #end
337
-
338
- #def self.set_dev_mode
339
- # ENV["TLOGGER_MODE"] = "dev"
340
- #end
341
-
342
- #def self.set_production_mode
343
- # ENV.delete("TLOGGER_MODE")
344
- #end
345
-
346
- #def self.is_dev?
347
- # ENV.keys.include?("TLOGGER_MODE") and ENV["TLOGGER_MODE"].downcase == "dev"
348
- #end
349
-
350
-
351
304
  private
352
305
  def format_message(key)
353
306
  # returning args array
@@ -406,6 +359,25 @@ module TeLogger
406
359
 
407
360
  end # find_caller
408
361
 
362
+ #
363
+ # :method: clear_exceptions
364
+ #
365
+ # Clear the exception list. All exampted tags given either by #off_all_tags_except or #on_all_tags_except
366
+ # shall be reset
367
+ #
368
+ def clear_exceptions
369
+ @exception.clear
370
+ end
371
+
372
+ #
373
+ # :method: remove_from_exception
374
+ #
375
+ # Remove a set of tags from the exception list
376
+ #
377
+ def remove_from_exception(*tags)
378
+ @exception.delete_if { |e| tags.include?(e) }
379
+ end
380
+
409
381
 
410
382
  end
411
383
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TeLogger
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/teLogger.rb CHANGED
@@ -14,6 +14,8 @@ module TeLogger
14
14
 
15
15
  module ClassMethods
16
16
  # methods called at class level by included class
17
+ # However if TeLogHelper is included inside Module1, only Module1 is included in Class1,
18
+ # Class1 will not be able to access the class level method here.
17
19
  def teLogger_tag(val)
18
20
  @telTag = val
19
21
  end
@@ -37,21 +39,36 @@ module TeLogger
37
39
  end
38
40
 
39
41
  end # ClassMethods
40
-
42
+
41
43
  def self.included(klass)
42
44
  klass.extend(ClassMethods)
43
- klass.class_eval <<-END
44
- extend TeLogger::TeLogHelper
45
- END
45
+ klass.extend(TeLogHelper)
46
46
  end
47
47
 
48
+ #def logOutput=(val)
49
+ # @logOut = val
50
+ #end
51
+
52
+ #def logOutput
53
+ # if self.class.respond_to?(:logOutput)
54
+ # self.class.logOutput
55
+ # else
56
+ # @logOut
57
+ # end
58
+ #end
59
+
48
60
  private
49
61
  def teLogger
50
62
  if @teLogger.nil?
51
63
  if self.class.respond_to?(:logOutput)
64
+ intLogger.debug "Class logOutput is #{self.class.logOutput}"
52
65
  @teLogger = Tlogger.new(*self.class.logOutput)
53
- else
66
+ elsif self.respond_to?(:logOutput)
67
+ intLogger.debug "logOutput is #{logOutput}"
54
68
  @teLogger = Tlogger.new(*logOutput)
69
+ else
70
+ intLogger.debug "logOutput is not available. Please note TeLogHelper mixin only works properly on directly included class/module. Fall back to console only"
71
+ @teLogger = Tlogger.new
55
72
  end
56
73
 
57
74
  if self.respond_to?(:logTag)
@@ -64,6 +81,20 @@ module TeLogger
64
81
  @teLogger
65
82
  end
66
83
 
84
+ def intLogger
85
+ if @intLogger.nil?
86
+ intLogOut = ENV['TELOGGER_INTLOG_OUT']
87
+ if intLogOut.nil? or intLogOut.empty?
88
+ @intLogger = Tlogger.new
89
+ else
90
+ intLogOut = [intLogOut] if not intLogOut.is_a?(Array)
91
+ @intLogger = Tlogger.new(*intLogOut)
92
+ end
93
+ end
94
+ @intLogger
95
+ end
96
+
97
+
67
98
  end
68
99
 
69
100
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teLogger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-05 00:00:00.000000000 Z
11
+ date: 2022-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devops_assist
@@ -32,6 +32,7 @@ executables: []
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
+ - ".release_history.yml"
35
36
  - ".rspec"
36
37
  - Gemfile
37
38
  - Gemfile.lock