Skip to content

Commit 678f4f3

Browse files
author
Stanislav Volovik
committed
StringException modification
1 parent 2211eca commit 678f4f3

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

lib/stackify/logger_client.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ def initialize
55
@@errors_governor = Stackify::ErrorsGovernor.new
66
end
77

8-
def log level, msg
8+
def log level, msg, call_trace
99
Stackify::Utils.do_only_if_authorized_and_mode_is_on Stackify::MODES[:logging] do
1010
if acceptable? level, msg && Stackify.working?
1111
worker = Stackify::AddMsgWorker.new
12-
task = log_message_task level, msg
12+
task = log_message_task level, msg, call_trace
1313
worker.async_perform ScheduleDelay.new, task
1414
end
1515
end
@@ -56,9 +56,12 @@ def is_appropriate_env?
5656
Stackify.configuration.env.downcase.to_sym == Stackify::EnvDetails.instance.auth_info['ConfiguredEnvironmentName'].downcase.to_sym
5757
end
5858

59-
def log_message_task level, msg
59+
def log_message_task level, msg, call_trace
6060
Stackify::ScheduleTask.new ({limit: 1}) do
61-
Stackify.msgs_queue << Stackify::MsgObject.new(level, msg, caller[0]).to_h
61+
e = Exception.new(msg)
62+
e.set_backtrace(call_trace)
63+
ex = StackifiedError.new(e, binding())
64+
Stackify.msgs_queue << Stackify::MsgObject.new(level, ex.message, caller[0], ex).to_h
6265
end
6366
end
6467

lib/stackify/logger_proxy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def initialize logger
88
LoggerProxy.class_eval do
99
define_method level.to_sym do |*args , &block|
1010
msg = message(args, block)
11-
Stackify.logger_client.log(level.downcase, msg)
11+
Stackify.logger_client.log(level.downcase, msg, caller)
1212
@logger.send(level.to_sym, args, &block)
1313
end
1414
end

0 commit comments

Comments
 (0)