def log_internal(level, index, message = nil, payload = nil, exception = nil, &block)
      log        = Log.new(name, level, index)
      should_log =
        if payload.nil? && exception.nil? && message.is_a?(Hash)
          # Check if someone just logged a hash payload instead of meaning to call semantic logger
          if message.key?(:message) || message.key?(:payload) || message.key?(:exception) || message.key?(:metric)
            log.assign(message)
          else
            log.assign_positional(nil, message, nil, &block)
          end
        else
          log.assign_positional(message, payload, exception, &block)
        end

      # Log level may change during assign due to :on_exception_level
      self.log(log) if should_log && should_log?(log)
    end
def log_internal(level, index, message = nil, payload = nil, exception = nil, &block)
      log        = Log.new(name, level, index)
      should_log =
        if payload.nil? && exception.nil? && message.is_a?(Hash)
          # Check if someone just logged a hash payload instead of meaning to call semantic logger
          if message.key?(:message) || message.key?(:payload) || message.key?(:exception) || message.key?(:metric)
            log.assign(message)
          else
            log.assign_positional(nil, message, nil, &block)
          end
        else
          log.assign_positional(message, payload, exception, &block)
        end

      # Log level may change during assign due to :on_exception_level
      self.log(log) if should_log && should_log?(log)
    end
Log message at the specified level