Top Level Namespace
Defined Under Namespace
Modules: Discordrb, ESM, Rails Classes: Array, ImmutableStruct, Inquirer, Integer, RebuildCommandCacheJob, SignalHandler, String, SyncCommandConfigurationsForCommunityJob, SyncCommandConfigurationsJob, SyncCommandCountsJob, Timer
Constant Summary collapse
- ESM_CORE_PATH =
Set up the shared Ruby classes
if (path = ENV["ESM_RUBY_CORE_PATH"]) && path.present? Pathname.new(path).join("lib") else Pathname.new(File.("../../", __dir__)).join("esm_ruby_core", "lib") end
Instance Method Summary collapse
-
#__log(severity, caller_data, content) ⇒ Object
Used internally by logging methods.
Instance Method Details
#__log(severity, caller_data, content) ⇒ Object
Used internally by logging methods. Do not call manually
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/esm.rb', line 84 def __log(severity, caller_data, content) if content.is_a?(Hash) && content[:error].is_a?(StandardError) e = content[:error] content[:error] = { class: e.class, message: e., backtrace: ESM.backtrace_cleaner.clean(e.backtrace) } end caller_class = caller_data .path .sub("#{__dir__}/", "") .sub(".rb", "") .classify caller_method = caller_data.label.gsub("block in ", "") ESM.logger.send(severity, "#{caller_class}##{caller_method}:#{caller_data.lineno}") do if content.is_a?(Hash) ESM::JSON.pretty_generate(content).presence || "" else content || "" end end end |