From 5518141ad5a05041b5494773c70c171244871191 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 12 Apr 2016 12:10:23 -0400 Subject: [PATCH] Option for verbose logging when API calls to create posts fail --- app/controllers/posts_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 1d0fb26e758..2a21e8607d4 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -458,6 +458,10 @@ class PostsController < ApplicationController json_obj = json_obj[:post] end + if !success && GlobalSetting.try(:verbose_api_logging) && is_api? + Rails.logger.error "Error creating post via API:\n\n#{json_obj.inspect}" + end + render json: json_obj, status: (!!success) ? 200 : 422 end