simple_cloud_logging 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/baselogger.rb +9 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd683ff7fe52dc2c5c198ed4ced779a1986555f0fac5532d3bec1155aa57ea73
4
- data.tar.gz: 4a9a8e2c3029cce1ddd2f66d563a99bdc547af132363d1a5eb8f19fd45679a92
3
+ metadata.gz: f33fe774542d11213b95c2092ee13ac688e1011ca65e0aa240993109a7294ff8
4
+ data.tar.gz: 539dd9ced7250c36873db76eb86577053a7d43d9e66e74eb18e32ac4a293ecc1
5
5
  SHA512:
6
- metadata.gz: 32c8feeefd5612315202a796fb0e95c4db9267f57911052dc89d6edad3246d265fe56169cc7925115a57a724344ff76f6e7eddccfa0d8a55139cff13784da58f
7
- data.tar.gz: 62938069cb37361de620e4c6c3b6f991337f287b09164683bf9e21aeefe5a641171c0599f11b7ee9ca3bbd084527bce4530c390d706c8fda1d2f04d872ca1817
6
+ metadata.gz: 637d485c0c4dc8a3d478e736907ceed432e9a95b0d01962ae1fd1da029072ab120985d2999013955a81d22968a3c693960ad19c31d7417c7e4a22eb15ba30bd3
7
+ data.tar.gz: 8e69eb2a2c92b918cfa527da8a49e84b50963fa51eb49a37a09c5aca5504fab9dbe61f86a6b17c876f404b525f42716cb201919886626b8560250ad691c15a05
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
metadata CHANGED
@@ -1,7 +1,7 @@
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.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi