mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 03:37:56 +01:00
Improve logging (#274)
* Add some custom log messages * Add original URL and remote IP to each log entry
This commit is contained in:
committed by
GitHub
parent
9c5553cc32
commit
1976e5ab3f
@@ -58,6 +58,8 @@ class ApplicationController < ActionController::Base
|
|||||||
private
|
private
|
||||||
|
|
||||||
def user_not_authorized
|
def user_not_authorized
|
||||||
|
logger.error { "User not authorized: #{user_signed_in? ? current_user.inspect : 'unlogged user'}" }
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
error: t('errors.unauthorized')
|
error: t('errors.unauthorized')
|
||||||
}, status: :unauthorized
|
}, status: :unauthorized
|
||||||
|
|||||||
@@ -47,9 +47,13 @@ class TenantsController < ApplicationController
|
|||||||
|
|
||||||
CreateWelcomeEntitiesWorkflow.new().run
|
CreateWelcomeEntitiesWorkflow.new().run
|
||||||
|
|
||||||
|
logger.info { "New tenant registration: #{Current.tenant.inspect}" }
|
||||||
|
|
||||||
render json: @tenant, status: :created
|
render json: @tenant, status: :created
|
||||||
|
|
||||||
rescue ActiveRecord::RecordInvalid => exception
|
rescue ActiveRecord::RecordInvalid => exception
|
||||||
|
logger.error { "Error in tenant registration: #{exception}" }
|
||||||
|
|
||||||
render json: { error: exception }, status: :unprocessable_entity
|
render json: { error: exception }, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ class OAuthExchangeAuthCodeForProfileWorkflow
|
|||||||
|
|
||||||
return profile_response
|
return profile_response
|
||||||
rescue => error
|
rescue => error
|
||||||
print(error)
|
logger.error { "Error in OAuthExchangeAuthCodeForProfileWorkflow: #{error}, o_auth: #{@o_auth.inspect}" }
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class OAuthSignInUserWorkflow
|
|||||||
|
|
||||||
return user
|
return user
|
||||||
rescue => error
|
rescue => error
|
||||||
print(error)
|
logger.error { "Error in OAuthSignInUserWorkflow: #{error}, o_auth: #{@o_auth.inspect}" }
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ Rails.application.configure do
|
|||||||
config.log_level = :debug
|
config.log_level = :debug
|
||||||
|
|
||||||
# Prepend all log lines with the following tags.
|
# Prepend all log lines with the following tags.
|
||||||
config.log_tags = [ :request_id ]
|
config.log_tags = [ :request_id, :original_url, :remote_ip ]
|
||||||
|
|
||||||
# Use a different cache store in production.
|
# Use a different cache store in production.
|
||||||
# config.cache_store = :mem_cache_store
|
# config.cache_store = :mem_cache_store
|
||||||
|
|||||||
Reference in New Issue
Block a user