local n=require(script.Parent.Fmt)local Z={Error=0;Warning=1;Info=2;Debug=3,Trace=4}local function w()return Z.Info end local function i(n,Z)return n..Z:gsub("\n","\n"..n)end local X=(" "):rep(15).."\091\077\097\122\101\071\101\110\101\114\097\116\111\114-\084\114\097\099\101\093 "local G=(" "):rep(15).."\091\077\097\122\101\071\101\110\101\114\097\116\111\114-\073\110\102\111\093 "local K=(" "):rep(15).."\091\077\097\122\101\071\101\110\101\114\097\116\111\114-\068\101\098\117\103\093 "local V="\091\077\097\122\101\071\101\110\101\114\097\116\111\114-\087\097\114\110\093 "local F={}F.Level=Z function F.setLogLevelThunk(n)w=n end function F.trace(G,...)if w()>=Z.Trace then print(i(X,n.fmt(G,...)))end end function F.info(X,...)if w()>=Z.Info then print(i(G,n.fmt(X,...)))end end function F.debug(X,...)if w()>=Z.Debug then print(i(K,n.fmt(X,...)))end end function F.warn(X,...)if w()>=Z.Warning then warn(i(V,n.fmt(X,...)))end end return F
local Fmt = require(script.Parent.Fmt)

local Level = {
	Error = 0,
	Warning = 1,
	Info = 2,
	Debug = 3,
	Trace = 4,
}

local function getLogLevel()
	return Level.Info
end

local function addTags(tag, message)
	return tag .. message:gsub('\n', '\n' .. tag)
end

local TRACE_TAG = (' '):rep(15) .. '[MazeGenerator-Trace] '
local INFO_TAG = (' '):rep(15) .. '[MazeGenerator-Info] '
local DEBUG_TAG = (' '):rep(15) .. '[MazeGenerator-Debug] '
local WARN_TAG = '[MazeGenerator-Warn] '

local Log = {}

Log.Level = Level

function Log.setLogLevelThunk(thunk)
	getLogLevel = thunk
end

function Log.trace(template, ...)
	if getLogLevel() >= Level.Trace then
		print(addTags(TRACE_TAG, Fmt.fmt(template, ...)))
	end
end

function Log.info(template, ...)
	if getLogLevel() >= Level.Info then
		print(addTags(INFO_TAG, Fmt.fmt(template, ...)))
	end
end

function Log.debug(template, ...)
	if getLogLevel() >= Level.Debug then
		print(addTags(DEBUG_TAG, Fmt.fmt(template, ...)))
	end
end

function Log.warn(template, ...)
	if getLogLevel() >= Level.Warning then
		warn(addTags(WARN_TAG, Fmt.fmt(template, ...)))
	end
end

return Log