simple_cloud_logging 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/baselogger.rb +9 -3
- 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: f33fe774542d11213b95c2092ee13ac688e1011ca65e0aa240993109a7294ff8
|
4
|
+
data.tar.gz: 539dd9ced7250c36873db76eb86577053a7d43d9e66e74eb18e32ac4a293ecc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
145
|
-
#
|
146
|
-
#
|
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
|