Jump to content

Logs


TorNix~|nR

Recommended Posts

Here you go :)

function time()
	local time = getRealTime();
	return "["..(time.monthday).."-"..(time.month+1).."-"..(time.year+1900).."|"..time.hour..":"..time.minute.."]";
end

function log(text)
	local f = fileOpen("logs.txt");
	if not f then
		f = fileCreate("logs.txt");
	end
	fileSetPos(f, fileGetSize(f));
	fileWrite(f, time().." "..text:gsub("#%x%x%x%x%x%x", "").."\r");
	fileFlush(f);
	fileClose(f);
end

log("SOMETHING");

You can also create a event to trigger it from another resource.

  • Thanks 1
Link to comment
6 hours ago, Tekken said:

Here you go :)


function time()
	local time = getRealTime();
	return "["..(time.monthday).."-"..(time.month+1).."-"..(time.year+1900).."|"..time.hour..":"..time.minute.."]";
end

function log(text)
	local f = fileOpen("logs.txt");
	if not f then
		f = fileCreate("logs.txt");
	end
	fileSetPos(f, fileGetSize(f));
	fileWrite(f, time().." "..text:gsub("#%x%x%x%x%x%x", "").."");
	fileFlush(f);
	fileClose(f);
end

log("SOMETHING");

You can also create a event to trigger it from another resource.

i know its solved but

line 12 should be like this :

fileWrite(f, time()..":"..text:gsub("#%x%x%x%x%x%x", "").."\r\n");

 

Edited by #,+( _xiRoc[K]; >
  • Like 1
Link to comment
5 hours ago, #,+( _xiRoc[K]; > said:

i know its solved but

line 12 should be like this :


fileWrite(f, time()..":"..text:gsub("#%x%x%x%x%x%x", "").."");

 

Nope!

Output

[4-8-2017|13:43] Tekken just did something.

It's just a preference. ;)

 

Greetings.

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...