simple_cloud_logging 1.2.5 → 1.2.7
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
- data/lib/dummylogger.rb +0 -4
- data/lib/locallogger.rb +0 -6
- data/lib/simple_cloud_logging.rb +0 -30
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45d0caad0577a87145e418ef7ee49fb80efd677340ccf1bf91ecca0813a1b316
|
4
|
+
data.tar.gz: d912ebe72beb36194ee75a03d705e47a3383490ff35a0550a04b4a8065e93eb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
data/lib/dummylogger.rb
CHANGED
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
|
data/lib/simple_cloud_logging.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2024-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|