# # In development mode log also to STDOUT # ActiveSupport::BufferedLogger.class_eval do def flush_with_stdout STDOUT.write(buffer.join) if crystal.include?(:config) and crystal[:config].development? and !buffer.empty? flush_without_stdout end alias_method_chain :flush, :stdout def info_with_format obj info_without_format(obj_to_string(obj)) end alias_method_chain :info, :format def warn_with_format obj warn_without_format("WARN: " + obj_to_string(obj)) end alias_method_chain :warn, :format def error_with_format obj error_without_format("ERROR: " + obj_to_string(obj)) end alias_method_chain :error, :format protected def obj_to_string obj if obj.is_a? Exception backtrace = (obj.backtrace && obj.backtrace.sfilter(Exception.common_filters)) || [] %{\ #{obj.message} #{backtrace.join("\n ")} } else obj.to_s end end end