Module: Legion::LLM::CompatWarning

Extended by:
Legion::Logging::Helper
Defined in:
lib/legion/llm/compat.rb

Class Method Summary collapse

Class Method Details

.warn_once(old_name, new_name) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/legion/llm/compat.rb', line 10

def self.warn_once(old_name, new_name)
  @warned ||= {}
  return if @warned[old_name]

  @warned[old_name] = true
  location = caller_locations(2, 1)&.first
  msg = "[DEPRECATION] #{old_name} is deprecated, use #{new_name} instead"
  msg += " (called from #{location})" if location
  log.warn(msg)
rescue StandardError
  warn msg
end