Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions lib/msf/core/modules/loader/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,7 @@ def load_error(module_path, error)
# backtraces should not appear.
module_manager.module_load_error_by_path[module_path] = "#{error.class} #{error}"

log_lines = []
log_lines << "#{module_path} failed to load due to the following error:"
log_lines << error.class.to_s
log_lines << error.to_s
if error.backtrace
log_lines << "Call stack:"
log_lines += error.backtrace
end

log_message = log_lines.join(' ')
elog(log_message)
elog("#{module_path} failed to load", error: error)
end

# Records the load warning to {Msf::ModuleManager::Loading#module_load_warnings} and the log.
Expand Down
6 changes: 5 additions & 1 deletion lib/rex/logging/log_dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ def elog(msg, src = 'core', log_level = 0, error: nil)
else
error_details = "#{error.class} #{error.message}"
if get_log_level(src) >= BACKTRACE_LOG_LEVEL
error_details << "\nCall stack:\n#{error.backtrace.join("\n")}"
if error.backtrace
error_details << "\nCall stack:\n#{error.backtrace.join("\n")}"
else
error_details << "\nCall stack:\nNone"
end
end

if msg.is_a?(Exception)
Expand Down