module Gapic::LoggingConcerns

def normalize_service input

Other tags:
    Private: -
def normalize_service input
  case input
  when String
    input
  when Class
    mod = input.name.split("::")[..-2].inject(Object) { |m, n| m.const_get n }
    if mod.const_defined? "Service"
      mod.const_get("Service").service_name
    else
      name_segments = input.name.split("::")[..-3]
      mod = name_segments.inject(Object) { |m, n| m.const_get n }
      name_segments.join "." if mod.const_defined? "Rest"
    end
  end
end