LogMessage=game.ServerScriptService.ServerConsole.LogMessage local I={}function I.new()local j={}j.Log={}j.IsErrorFree=true j.LogInfo=I.LogInfo j.LogMessage=I.LogMessage j.LogOutput=I.LogOutput j.LogWarning=I.LogWarning j.LogError=I.LogError j.BulkLog=I.BulkLog j.SendToServerLog=I.SendToServerLog return j end function I.LogMessage(b,I,j)assert(typeof(I)=="\115\116\114\105\110\103")assert(typeof(j)=="\069\110\117\109\073\116\101\109"and j.EnumType==Enum.MessageType)if j==Enum.MessageType.MessageError then b.IsErrorFree=false end table.insert(b.Log,{message=I,messageType=j})end function I.LogInfo(j,I)return j:LogMessage(I,Enum.MessageType.MessageInfo)end function I.LogOutput(j,I)return j:LogMessage(I,Enum.MessageType.MessageOutput)end function I.LogWarning(j,I)return j:LogMessage(I,Enum.MessageType.MessageWarning)end function I.LogError(j,I)return j:LogMessage(I,Enum.MessageType.MessageError)end function I.BulkLog(j,I)for I,b in ipairs(I)do j:LogMessage(b.message,b.messageType)end end function I.SendToServerLog(I)for I,j in ipairs(I.Log)do LogMessage:Invoke(j.message,j.messageType)end end return I
-- Provides a generic log object that functions can use to output a variety of messages in one go.
--
-- ForbiddenJ

LogMessage = game.ServerScriptService.ServerConsole.LogMessage

local mod = {}

function mod.new()
	local self = {}

	self.Log = {}
	self.IsErrorFree = true

	self.LogInfo = mod.LogInfo
	self.LogMessage = mod.LogMessage
	self.LogOutput = mod.LogOutput
	self.LogWarning = mod.LogWarning
	self.LogError = mod.LogError
	self.BulkLog = mod.BulkLog
	self.SendToServerLog = mod.SendToServerLog

	return self
end

function mod:LogMessage(message, messageType)
	assert(typeof(message) == "string")
	assert(typeof(messageType) == "EnumItem" and messageType.EnumType == Enum.MessageType)

	if messageType == Enum.MessageType.MessageError then
		self.IsErrorFree = false
	end

	table.insert(self.Log, { message = message, messageType = messageType })
end
function mod:LogInfo(message)
	return self:LogMessage(message, Enum.MessageType.MessageInfo)
end
function mod:LogOutput(message)
	return self:LogMessage(message, Enum.MessageType.MessageOutput)
end
function mod:LogWarning(message)
	return self:LogMessage(message, Enum.MessageType.MessageWarning)
end
function mod:LogError(message)
	return self:LogMessage(message, Enum.MessageType.MessageError)
end
function mod:BulkLog(messageEntries)
	for i, entry in ipairs(messageEntries) do
		self:LogMessage(entry.message, entry.messageType)
	end
end
function mod:SendToServerLog()
	for i, entry in ipairs(self.Log) do
		LogMessage:Invoke(entry.message, entry.messageType)
	end
end

return mod
