Chatlog cleaner/converter


(Domagoj) #1

Hi, ive heard there is a tool in which you can upload whole .log file, and it will delete all unecessary things and just leave the chat on it. anyone have it/heard of it? thanks


(Micha) #2

I heared of it too but donno rigth now. I just know kmod+ used this:

code part of game.lua (kmod+)


function log_chat( PlayerID, mode, text, PMID )
	local text = et.Q_CleanStr(text)
	local fdadm,len = et.trap_FS_FOpenFile( 'kmod+/misc/chat_log.log', et.FS_APPEND )
	local time = os.date("%x %I:%M:%S%p")
	local ip 
	local guid
	if mode == et.SAY_ALL then
		ip = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" ))
		guid = global_players_table[PlayerID]["guid"]
		local name = global_players_table[PlayerID]["name"]
		local name = et.Q_CleanStr( name )
		LOG = string.format("%s %5s %32s: %s
",time,"(ALL)",name,text)
	elseif mode == et.SAY_TEAM then
		ip = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" ))
		guid = global_players_table[PlayerID]["guid"]
		local name = global_players_table[PlayerID]["name"]
		local name = et.Q_CleanStr( name )
		LOG = string.format("%s %5s %32s: %s
",time,"(TEAM)",name,text)
	elseif mode == et.SAY_BUDDY then
		ip = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" ))
		guid = global_players_table[PlayerID]["guid"]
		local name = global_players_table[PlayerID]["name"]
		local name = et.Q_CleanStr( name )
		LOG = string.format("%s %5s %32s: %s
",time,"(FIRETEAM)",name,text)
	elseif mode == et.SAY_TEAMNL then
		ip = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" ))
		guid = global_players_table[PlayerID]["guid"]
		local name = global_players_table[PlayerID]["name"]
		local name = et.Q_CleanStr( name )
		LOG = string.format("%s %5s %32s: %s
",time,"(TEAM)",name,text)
	elseif mode == "VSAY_TEAM" then
		ip = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" ))
		guid = global_players_table[PlayerID]["guid"]
		local name = global_players_table[PlayerID]["name"]
		local name = et.Q_CleanStr( name )
		LOG = "("..time..")(VSAY_TEAM) "..name.. ": " ..text.. "
"
	elseif mode == "VSAY_BUDDY" then
		ip = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" ))
		guid = global_players_table[PlayerID]["guid"]
		local name = global_players_table[PlayerID]["name"]
		local name = et.Q_CleanStr( name )
		LOG = "("..time..")(VSAY_BUDDY) "..name.. ": " ..text.. "
"
	elseif mode == "VSAY_ALL" then
		ip = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" ))
		guid = global_players_table[PlayerID]["guid"]
		local name = global_players_table[PlayerID]["name"]
		local name = et.Q_CleanStr( name )
		LOG = "("..time..")(VSAY) "..name.. ": " ..text.. "
"
	elseif mode == "PMESSAGE" then
		local from = "SERVER"
		if PlayerID ~= 1022 then
			from = global_players_table[PlayerID]["name"]
			ip = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" ))
			guid = global_players_table[PlayerID]["guid"]
		end
		local rec1 = part2id(PMID)
		if rec1 then
			local recipiant = et.gentity_get(rec1,"pers.netname")
			LOG = "("..time..")(PRIVATE: "..from.." -> "..recipiant.."): " ..text.. "
"
		end
	elseif mode == "PMADMINS" then
		local from = "SERVER"
		if PlayerID ~= 1022 then
			ip = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" ))
			guid = global_players_table[PlayerID]["guid"]
			from = global_players_table[PlayerID]["name"]
		else
			ip = "127.0.0.1"
			guid = "NONE!"
		end
		local recipiant = "ADMINS"
		LOG = "("..time..")(PRIVATE: "..from.." -> "..recipiant.."): " ..text.. "
"
	elseif mode == "ADMIN_COMMAND" then
		local admin = "SERVER"
		if tonumber(PlayerID) ~= nil then
			admin = global_players_table[PlayerID]["name"]
			admin = et.Q_CleanStr( admin )
		end
		LOG = "("..time..")(ADMIN_COMMAND - "..PMID.." ) "..admin.." : !" ..PMID.. " "..text.. "
"

	elseif mode == "CONN" then
		ip = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" ))
		guid = global_players_table[PlayerID]["guid"]
		local name = global_players_table[PlayerID]["name"]
		local name = et.Q_CleanStr( name )
		LOG = "*** ("..time..") " ..name.. " HAS ENTERED THE GAME  (IP: " .. ip .. " GUID: " .. guid .. ") ***
"
	elseif mode == "NAME_CHANGE" then
		LOG = "*** ("..time..") " ..PlayerID.. " HAS RENAMED TO "..text.." ***
"
	elseif mode == "DISCONNECT" then
		local name = global_players_table[PlayerID]["name"]
		local name = et.Q_CleanStr( name )
		LOG = "*** ("..time..") " ..name.. " HAS DISCONNECTED ***
"
	elseif mode == "START" then
		LOG = "
("..time..")	***SERVER RESTART OR MAP CHANGE***

"
	end

	et.trap_FS_Write( LOG, string.len(LOG) ,fdadm )
	et.trap_FS_FCloseFile( fdadm )
end


(Domagoj) #3

Well, heard there is a exe of it somewhere, you just upload the log file, and it puts you out the cleaned version. but thanks anyway, hope someone else might know more about it.


(stealth6) #4

Maybe this?
http://forums.warchest.com/showthread.php/19000-W-ET-Log-Analyzer