nub 0.0.35 → 0.0.36
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/nub/log.rb +13 -5
- 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: 20dfa82087dac3fc6f2aca133219ffff8f13614017c6a0ce78c07b28ab63ccb1
|
4
|
+
data.tar.gz: 4874238d59fab76c44734625345372ab8d18e465fb1c9d4c04399e57f2a3b936
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02fc00dd683da7166068c94209cd154db09747c9adde25e5f397de7aefda175864cd3b35bbe3003cd3c75d4b3c3159fe6d1ff518feb577258cfbee3586c3f2f9
|
7
|
+
data.tar.gz: 4dfcd93cacdd01224bad1872523f9e9d8473e07eac6d645fd70c56d00e8c98fd5b5b22301ff57c529de8b14c66e2e1974685f693c3edf6ef4a807f380b82a35f
|
data/lib/nub/log.rb
CHANGED
@@ -73,7 +73,8 @@ module Log
|
|
73
73
|
@@_monitor.synchronize{
|
74
74
|
|
75
75
|
# Skip first 3 on stack (i.e. 0 = block in format, 1 = synchronize, 2 = format)
|
76
|
-
stack = caller_locations(3,
|
76
|
+
stack = caller_locations(3, 10)
|
77
|
+
#stack.each{|x| $stdout.puts(x.label)}
|
77
78
|
|
78
79
|
# Skip past any calls in 'log.rb' or 'monitor.rb'
|
79
80
|
i = -1
|
@@ -85,14 +86,21 @@ module Log
|
|
85
86
|
# Save lineno from original location
|
86
87
|
lineno = stack[i].lineno
|
87
88
|
|
88
|
-
# Skip over block type functions to use method
|
89
|
-
|
90
|
-
|
89
|
+
# Skip over block type functions to use method.
|
90
|
+
# Note: there may not be a non block method e.g. in thread case
|
91
|
+
regexps = [Regexp.new('^rescue\s.*in\s'), Regexp.new('^block\s.*in\s'), Regexp.new('^each$')]
|
92
|
+
while regexps.any?{|regexp| stack[i].label =~ regexp} do
|
93
|
+
break if i + 1 == stack.size
|
91
94
|
i += 1
|
92
95
|
end
|
93
96
|
|
97
|
+
# Set label, clean up for block case
|
98
|
+
label = stack[i].label
|
99
|
+
regexps.each{|x| label = label.gsub(label[x], "") if stack[i].label =~ x}
|
100
|
+
label = stack[i].label if label.empty?
|
101
|
+
|
94
102
|
# Construct stamp
|
95
|
-
loc = ":#{File.basename(stack[i].path, '.rb')}:#{
|
103
|
+
loc = ":#{File.basename(stack[i].path, '.rb')}:#{label}:#{lineno}"
|
96
104
|
return "#{Time.now.utc.iso8601(3)}#{loc}:: #{str}"
|
97
105
|
}
|
98
106
|
end
|