From df94d40b737bbc5af69ea94121c50f01e744ca3a Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Fri, 11 Dec 2020 13:35:37 +0100 Subject: [PATCH] provide debug method --- lib/additionals.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/additionals.rb b/lib/additionals.rb index 135a5e57..ff4500d5 100644 --- a/lib/additionals.rb +++ b/lib/additionals.rb @@ -93,6 +93,12 @@ module Additionals false end + def debug(message) + return if Rails.env.production? + + Rails.logger.debug "#{Time.current.strftime('%H:%M:%S')} DEBUG [#{caller_locations(1..1).first.label}]: #{message}" + end + def class_prefix(klass) klass_name = klass.is_a?(String) ? klass : klass.name klass_name.underscore.tr '/', '_'