class Async::Logger

def format_exception(exception, prefix = nil, pwd: Dir.pwd, output: @output)

def format_exception(exception, prefix = nil, pwd: Dir.pwd, output: @output)
	output.puts " #{prefix}#{@exception_title_style}#{exception.class}#{@reset_style}: #{exception}"
	
	exception.backtrace.each_with_index do |line, index|
		path, offset, message = line.split(":")
		
		# Make the path a bit more readable
		path.gsub!(/^#{pwd}\//, "./")
		
		output.puts " #{index == 0 ? "→" : " "} #{@exception_line_style}#{path}:#{offset}#{@reset_style} #{message}"
	end
	
	if exception.cause
		format_exception(exception.cause, "Caused by ", pwd: pwd, output: output)
	end
end