Option for verbose logging when API calls to create posts fail

This commit is contained in:
Robin Ward 2016-04-12 12:10:23 -04:00
parent fe6f587d4d
commit 5518141ad5
No known key found for this signature in database
GPG Key ID: 0E091E2B4ED1B83D
1 changed files with 4 additions and 0 deletions

View File

@ -458,6 +458,10 @@ class PostsController < ApplicationController
json_obj = json_obj[:post] json_obj = json_obj[:post]
end 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 render json: json_obj, status: (!!success) ? 200 : 422
end end