<commit_before>local msg = {}
local function ansiesc(num)
	return (string.char(27) .. '[%dm'):format(num)
end

msg.out = io.stderr

msg.add = function(str)
	msg.out:write(str)
end

msg.line = function(str)
	msg.add("\n"..(str or ""))
end

msg.indent = function(str)
	msg.line("\t"..(str or ""))
end

msg.format = function(str, ...)
	msg.add(str:format(...))
end

msg.color = function(c, m, ...)
	msg.add("\n"..ansiesc(c).."["..m:upper().."]".. ansiesc(0) .. " "..table.concat({...} or {},"\t"))
end

msg.done = function(str)
	msg.add(" "..ansiesc(32)..(str or "Done.")..ansiesc(0))
end

msg.fail = function(str)
	msg.add(" "..ansiesc(31)..(str or "Failed!")..ansiesc(0))
end

msg.fatal = function(...)
	msg.color(31, "fatal", ..., "\n\n")
	os.exit(1)
end

msg.error = function(...)
	msg.color(31, "help", ...)
end

msg.warning = function(...)
	msg.color(33, "warn", ...)
end

msg.info = function(...)
	msg.color(32, "info", ...)
end

msg.contents = function(tbl)
	msg.line()

	for k, v in pairs(tbl) do
		msg.indent(tostring(k).."\t"..tostring(v))
	end

	msg.line()
end

msg.dump = function(...)
	local arg = {...}

	msg.line()

	for i=1, #arg do
		msg.indent(tostring(arg[i]))
	end

	msg.line()
end

module(...)

return msg
<commit_msg>added better msg.dump<commit_after>local msg = {}
local function ansiesc(num)
	return (string.char(27) .. '[%dm'):format(num)
end

msg.out = io.stderr

msg.add = function(str)
	msg.out:write(str)
end

msg.line = function(str)
	msg.add("\n"..(str or ""))
end

msg.indent = function(str)
	msg.line("\t"..(str or ""))
end

msg.format = function(str, ...)
	msg.add(str:format(...))
end

msg.color = function(c, m, ...)
	msg.add("\n"..ansiesc(c).."["..m:upper().."]".. ansiesc(0) .. " "..table.concat({...} or {},"\t"))
end

msg.done = function(str)
	msg.add(" "..ansiesc(32)..(str or "Done.")..ansiesc(0))
end

msg.fail = function(str)
	msg.add(" "..ansiesc(31)..(str or "Failed!")..ansiesc(0))
end

msg.fatal = function(...)
	msg.color(31, "fatal", ..., "\n\n")
	os.exit(1)
end

msg.error = function(...)
	msg.color(31, "help", ...)
end

msg.warning = function(...)
	msg.color(33, "warn", ...)
end

msg.info = function(...)
	msg.color(32, "info", ...)
end

msg.contents = function(tbl)
	msg.line()

	for k, v in pairs(tbl) do
		msg.indent(tostring(k).."\t"..tostring(v))
	end

	msg.line()
end

msg.dump = function(...)
	local objs = {...}
	local dmp = function(dmp, obj, name, ind)
		local tp = type(obj)
		local ind = ind or ""
		local name = name or ""
		local val = "["..tp.."]"

		if tp == "string" then
			val = obj
		end

		msg.format("%s%s: %s\n", ind, name, val)

		if tp == "table" then
			if #name then
				name = name.."."
			end

			for k, v in pairs(obj) do
				dmp(dmp, v, k, ind.."\t")
			end
		end
	end

	for i = 1, #objs do
		msg.line()
		dmp(dmp, objs[i], "arg"..i)
	end
end


module(...)

return msg

{'fraction_non_alphanumeric': 0.2520154223624255, 'fraction_numerical': 0.01331931300385559, 'mean_word_length': 2.8724559023066485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2036563', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1214, 'n_words': 265}