mole 1.0.7 → 1.0.8
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.
- data/lib/mole/moler.rb +11 -3
- data/lib/mole/version.rb +1 -1
- metadata +1 -1
data/lib/mole/moler.rb
CHANGED
@@ -16,7 +16,7 @@ module Mole
|
|
16
16
|
# If exception is given record the first couple of frames
|
17
17
|
if args[:boom]
|
18
18
|
args[:trace] = dump_stack( args[:boom] )
|
19
|
-
args[:boom] = args[:boom].to_s
|
19
|
+
args[:boom] = truncate( args[:boom].to_s )
|
20
20
|
end
|
21
21
|
if ::Mole.persistent?
|
22
22
|
MoleLog.log_it( context, MoleFeature::find_exception_feature( ::Mole.application ), user_id, args )
|
@@ -54,10 +54,18 @@ module Mole
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
# Truncate
|
58
|
+
def truncate(text, length = 200, truncate_string = "...")
|
59
|
+
return "" if text.nil?
|
60
|
+
l = length - truncate_string.chars.length
|
61
|
+
text.chars.length > length ? (text.chars[0...l] + truncate_string).to_s : text
|
62
|
+
end
|
63
|
+
|
57
64
|
# dumps partial stack
|
58
|
-
def dump_stack( boom )
|
65
|
+
def dump_stack( boom )
|
66
|
+
return truncate( boom.backtrace[0] ) if boom.backtrace.size == 1
|
59
67
|
buff = boom.backtrace[0...3].join( "-" )
|
60
|
-
end
|
68
|
+
end
|
61
69
|
end
|
62
70
|
end
|
63
71
|
end
|
data/lib/mole/version.rb
CHANGED