local G="  "local v=(require(script.Parent.Parent.util)).inspect return function()local S={}local d=0 local function u()return string.rep(G,d)end function S.log(G,...)local S if typeof(G)=="\115\116\114\105\110\103"then S=string.format(G,...)else S=v(G)end print(u()..S)end function S.debug(G,...)local S if typeof(G)=="\115\116\114\105\110\103"then S=string.format(G,...)else S=v(G)end print(u()..S)end function S.info(G,...)local S if typeof(G)=="\115\116\114\105\110\103"then S=string.format(G,...)else S=v(G)end print(u()..S)end function S.warn(G,...)local S if typeof(G)=="\115\116\114\105\110\103"then S=string.format(G,...)else S=v(G)end warn(u()..S)end function S.error(G,...)local S if typeof(G)=="\115\116\114\105\110\103"then S=string.format(G,...)else S=v(G)end warn(u()..S)end function S.group(G,...)local S if typeof(G)=="\115\116\114\105\110\103"then S=string.format(G,...)else S=v(G)end print(u()..S)d=d+1 end function S.groupCollapsed(G,...)local S if typeof(G)=="\115\116\114\105\110\103"then S=string.format(G,...)else S=v(G)end print(u()..S)d=d+1 end function S.groupEnd()if d>0 then d=d-1 end end return S end

local INDENT = "  "
local inspect = require(script.Parent.Parent.util).inspect

return function()
	local console = {}
	local indentDepth = 0

	local function indent()
		return string.rep(INDENT, indentDepth)
	end

	function console.log(content, ...)
		local message
		if typeof(content) == "string" then
			message = string.format(content, ...)
		else
			message = inspect(content)
		end
		print(indent() .. message)
	end

	function console.debug(content, ...)
		local message
		if typeof(content) == "string" then
			message = string.format(content, ...)
		else
			message = inspect(content)
		end
		print(indent() .. message)
	end

	function console.info(content, ...)
		local message
		if typeof(content) == "string" then
			message = string.format(content, ...)
		else
			message = inspect(content)
		end
		print(indent() .. message)
	end

	function console.warn(content, ...)
		local message
		if typeof(content) == "string" then
			message = string.format(content, ...)
		else
			message = inspect(content)
		end
		warn(indent() .. message)
	end

	function console.error(content, ...)
		-- JS' `console.error` doesn't interrupt execution like Lua's `error`,
		-- which is more similar to throwing an exception in JS.
		local message
		if typeof(content) == "string" then
			message = string.format(content, ...)
		else
			message = inspect(content)
		end
		warn(indent() .. message)
	end

	function console.group(content, ...)
		local message
		if typeof(content) == "string" then
			message = string.format(content, ...)
		else
			message = inspect(content)
		end
		print(indent() .. message)
		indentDepth = indentDepth + 1
	end

	function console.groupCollapsed(content, ...)
		-- There's no smart console, so this is equivalent to `console.group`
		local message
		if typeof(content) == "string" then
			message = string.format(content, ...)
		else
			message = inspect(content)
		end
		print(indent() .. message)
		indentDepth = indentDepth + 1
	end

	function console.groupEnd()
		if indentDepth > 0 then
			indentDepth = indentDepth - 1
		end
	end

	return console
end
