teLogger 0.1.0 → 0.2.1

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: c9393cf71439c158c10ec22a544e13d176e2aaa4f80d38d66dece29847d5ec02
4
+ data.tar.gz: 82b81e7be21b5e1e4f6dfabf993ddd065be1ace3523f36f13176391b2dfbfd60
5
5
  SHA512:
6
- metadata.gz: 6bccfe28dd331dc3a5e594c7d36c8ddf2ba3449b9702dab305cf6694fa0be159208e73950f0d963728fb5fd1de847d528e96964ba88ce286c7c64f487608820d
7
- data.tar.gz: bac3ec9366528a8a6d1dc12056bb6c0ffc0e6432cc4b9d1b2e800c1671062a9a6293e07b52e7728a6fc280801b7a0d688638e5108b0e964eaf522c5f694c5884
6
+ metadata.gz: 6e2da8f552f3b506a00cfab55099a1a616515f265aaf6b96c5a27b7114b986a6af547bf26ae86e5f7008611cebe6d476a3a3ca6c8e7569c6c71def3cbbaf2ff2
7
+ data.tar.gz: dc0df4a1a37ad627b1050cbfb7504c5e2e50913dc8c8988dfa6f3d943761f7f92e572210bde263e405c496f72cc49c8c8331b602ea34fb243d565f0bc00d0543
@@ -0,0 +1,6 @@
1
+ ---
2
+ teLogger:
3
+ - :version: 0.1.0
4
+ :timestamp: 1654445209.1001852
5
+ - :version: 0.2.0
6
+ :timestamp: 1657796873.8053865
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- teLogger (0.1.0)
4
+ teLogger (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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.1"
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,37 @@ module TeLogger
37
39
  end
38
40
 
39
41
  end # ClassMethods
40
-
42
+
41
43
  def self.included(klass)
44
+ puts "TeLogHelper : #{klass}"
42
45
  klass.extend(ClassMethods)
43
- klass.class_eval <<-END
44
- extend TeLogger::TeLogHelper
45
- END
46
+ klass.extend(TeLogHelper)
46
47
  end
47
48
 
49
+ #def logOutput=(val)
50
+ # @logOut = val
51
+ #end
52
+
53
+ #def logOutput
54
+ # if self.class.respond_to?(:logOutput)
55
+ # self.class.logOutput
56
+ # else
57
+ # @logOut
58
+ # end
59
+ #end
60
+
48
61
  private
49
62
  def teLogger
50
63
  if @teLogger.nil?
51
64
  if self.class.respond_to?(:logOutput)
65
+ intLogger.debug "Class logOutput is #{self.class.logOutput}"
52
66
  @teLogger = Tlogger.new(*self.class.logOutput)
53
- else
67
+ elsif self.respond_to?(:logOutput)
68
+ intLogger.debug "logOutput is #{logOutput}"
54
69
  @teLogger = Tlogger.new(*logOutput)
70
+ else
71
+ intLogger.debug "logOutput is not available in #{self}. Please note TeLogHelper mixin only works properly on directly included class/module. Fall back to console only"
72
+ @teLogger = Tlogger.new
55
73
  end
56
74
 
57
75
  if self.respond_to?(:logTag)
@@ -64,7 +82,24 @@ module TeLogger
64
82
  @teLogger
65
83
  end
66
84
 
85
+ def intLogger
86
+ if @intLogger.nil?
87
+ intLogOut = ENV['TELOGGER_INTLOG_OUT']
88
+ if intLogOut.nil? or intLogOut.empty?
89
+ @intLogger = Tlogger.new
90
+ else
91
+ intLogOut = [intLogOut] if not intLogOut.is_a?(Array)
92
+ @intLogger = Tlogger.new(*intLogOut)
93
+ end
94
+ end
95
+ @intLogger
96
+ end
97
+
98
+
67
99
  end
68
100
 
69
101
 
70
102
  end
103
+
104
+ TeLogger::Helper = TeLogger::TeLogHelper
105
+
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.1
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-12-09 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