simple_cloud_logging 1.2.5 → 1.2.7

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: bd683ff7fe52dc2c5c198ed4ced779a1986555f0fac5532d3bec1155aa57ea73
4
- data.tar.gz: 4a9a8e2c3029cce1ddd2f66d563a99bdc547af132363d1a5eb8f19fd45679a92
3
+ metadata.gz: 45d0caad0577a87145e418ef7ee49fb80efd677340ccf1bf91ecca0813a1b316
4
+ data.tar.gz: d912ebe72beb36194ee75a03d705e47a3383490ff35a0550a04b4a8065e93eb4
5
5
  SHA512:
6
- metadata.gz: 32c8feeefd5612315202a796fb0e95c4db9267f57911052dc89d6edad3246d265fe56169cc7925115a57a724344ff76f6e7eddccfa0d8a55139cff13784da58f
7
- data.tar.gz: 62938069cb37361de620e4c6c3b6f991337f287b09164683bf9e21aeefe5a641171c0599f11b7ee9ca3bbd084527bce4530c390d706c8fda1d2f04d872ca1817
6
+ metadata.gz: 575e785d03b6dcd799b91d08de46fa2029cdb9b5d1b2416a50b634330f379adacb8f7a0f93ef8d015f06b9cbdb84f13def19c03f5d709fefaf9216389da1c9b4
7
+ data.tar.gz: edcb4ebf3bd619c1ec14bf563c02ea9e6a70d8105179c00b4b11dd7724c4008f6bf61f45636b4da8d332aafcc8620137d1618f94cd5132fcb164ed42a31d36f9
data/lib/baselogger.rb CHANGED
@@ -141,9 +141,15 @@ module BlackStack
141
141
  # - https://stackoverflow.com/questions/37564928/how-to-find-out-from-which-line-number-the-method-was-called-in-ruby
142
142
  # - https://ruby-doc.org/core-2.2.3/Thread/Backtrace/Location.html
143
143
  #binding.pry if s == "Looking for number 3... "
144
- caller = caller_locations(0..).last
145
- #binding.pry if s == '1... '
146
- #binding.pry if s == '4... '
144
+
145
+ # Get the file and line from where this method logs was called
146
+ # - References:
147
+ # - https://github.com/leandrosardi/simple_cloud_logging/issues/6
148
+ #
149
+ callers = caller_locations(0..).to_a
150
+ prev_caller = callers.select { |c| c.to_s.include?('locallogger.rb') }.last
151
+ prev_index = callers.index(prev_caller)
152
+ caller = callers[prev_index+1].to_s
147
153
 
148
154
  # if the parent level was called from the same line, I am missing to close the parent.
149
155
  if self.level_open_callers[self.level-1].to_s == caller.to_s
data/lib/dummylogger.rb CHANGED
@@ -18,9 +18,5 @@ module BlackStack
18
18
  def logf(s, datetime=nil)
19
19
  end # def logf
20
20
 
21
- #
22
- def release()
23
- end
24
-
25
21
  end # class LocalLogger
26
22
  end # module BlackStack
data/lib/locallogger.rb CHANGED
@@ -5,7 +5,6 @@ module BlackStack
5
5
  # call the save method to store the new attributes into the data file
6
6
  def reset()
7
7
  super
8
- BlackStack::LocalLoggerFactory::save(self.filename, self)
9
8
  end
10
9
 
11
10
  # store the min allowed bytes in the variable min
@@ -55,10 +54,5 @@ module BlackStack
55
54
  ltext
56
55
  end # def logf
57
56
 
58
- #
59
- def release()
60
- BlackStack::LocalLoggerFactory.release(self.filename)
61
- end
62
-
63
57
  end # class LocalLogger
64
58
  end # module BlackStack
@@ -4,33 +4,3 @@ require 'blackstack-core'
4
4
  require_relative './baselogger'
5
5
  require_relative './dummylogger'
6
6
  require_relative './locallogger'
7
-
8
- module BlackStack
9
- class LocalLoggerFactory
10
- #
11
- def self.create(filename)
12
- data_filename = "#{filename}.data"
13
- ret = BlackStack::LocalLogger.new(filename)
14
- if File.exist?(data_filename)
15
- f = File.open(data_filename,"r")
16
- data = f.read.split(/,/)
17
- ret.nest_level = data[0].to_i
18
- ret.number_of_lines_in_current_level = data[1].to_i
19
- ret.current_nest_level = data[2].to_i
20
- f.close
21
- end
22
- ret
23
- end
24
-
25
- #
26
- def self.save(filename, locallogger)
27
- data_filename = "#{filename}.data"
28
- ret = BlackStack::LocalLogger.new(filename)
29
- f = File.open(data_filename,"w")
30
- f.write "#{locallogger.nest_level.to_s},#{locallogger.number_of_lines_in_current_level.to_s},#{locallogger.current_nest_level.to_s}"
31
- f.close
32
- end
33
-
34
- end # class LocalLoggerFactory
35
-
36
- end # module BlackStack
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_cloud_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-26 00:00:00.000000000 Z
11
+ date: 2024-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize