SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 22/10/2011, 08:10 PM   #1
JernejL
Beta Tester
 
JernejL's Avatar
 
Join Date: Jan 2006
Location: Slovenia
Posts: 569
Reputation: 368
Default Execution Logger (0.3C version)

Recently i went thru a low level overhaul of the main gamemode that i work with, it is sometimes very difficult to monitor what a script is doing in background - i am sure that a lot of you spent many sessions placing and removing printf calls all around code while trying to debug complex bugs and issues in your scripts.

So i built this plugin, which logs all operative calls. This excludes the GetPlayerxxx, IsPlayerxxx and a few other functions on purpose, as the functions which retrieve data from sa-mp aren't as important as those that SET it - but you can recompile the plugin to see those (and the resulting spam) as well., the defines are in the plugin to do so.

The calls and data is all outputted to sa-mp console / server log, here is a example output:

Code:
[19:51:48] IsPlayerConnected (playerid = 349, result = 0);
[19:51:48] SetTimer (funcname = "RunWeatherTimer" interval = 1000 repeating = 1, result = 3);
[19:51:48] SetTimer (funcname = "CheckIRCCommand" interval = 1000 repeating = 1, result = 4);
[19:51:48] CreateMenu (title = "Spectator" columns = 2 x = 125.00000 y = 130.00000 col1width = 190.00000 col2width = 0.0 = 150.00000, result = MENU:1);
[19:51:48] SetMenuColumnHeader (menuid = MENU:1 column = 0 columnheader = "Action", result = 1);
[19:51:48] SetMenuColumnHeader (menuid = MENU:1 column = 1 columnheader = "Mouse + Keys", result = 1);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 0 menutext = "----------------------", result = 0);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 1 menutext = "----------------------", result = 0);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 0 menutext = "Previous player:", result = 1);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 1 menutext = "~k~~PED_LOCK_TARGET~", result = 1);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 0 menutext = "Next player:", result = 2);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 1 menutext = "~k~~PED_FIREWEAPON~", result = 2);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 0 menutext = "Change view:", result = 3);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 1 menutext = "~k~~PED_DUCK~", result = 3);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 0 menutext = "Exit spectator:", result = 4);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 1 menutext = "~k~~PED_JUMPING~", result = 4);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 0 menutext = "----------------------", result = 5);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 1 menutext = "----------------------", result = 5);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 0 menutext = " ", result = 6);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 1 menutext = " ", result = 6);
[19:51:48] AddMenuItem (menuid = MENU:1 column = 0 menutext = "                     Accept", result = 7);
[19:51:48] DisableMenuRow (menuid = MENU:1 row = 0, result = 1);
[19:51:48] DisableMenuRow (menuid = MENU:1 row = 1, result = 1);
[19:51:48] DisableMenuRow (menuid = MENU:1 row = 2, result = 1);
[19:51:48] DisableMenuRow (menuid = MENU:1 row = 3, result = 1);
[19:51:48] DisableMenuRow (menuid = MENU:1 row = 4, result = 1);
[19:51:48] DisableMenuRow (menuid = MENU:1 row = 5, result = 1);
[19:51:48] DisableMenuRow (menuid = MENU:1 row = 6, result = 1);
[19:51:48] CreateObject (modelid = 14548 X = 335.81201 Y = 1004.71997 Z = 1950.50000 rX = 13.00000 rY = 0.00000 rZ = 0.00000 DrawDistance = 0.0 = 0.00000, result = 1);
[19:51:48] CreateObject (modelid = 14548 X = -1343.31775 Y = -272.34680 Z = 300.57529 rX = 13.00000 rY = 0.00000 rZ = 46.81210 DrawDistance = 0.0 = 0.00000, result = 2);
[19:51:48] CreateObject (modelid = 14548 X = 282.26001 Y = 1076.01001 Z = 0.00000 rX = 13.00000 rY = 0.00000 rZ = 90.00000 DrawDistance = 0.0 = 0.00000, result = 3);
[19:51:48] CreateObject (modelid = 4847 X = -1117.63000 Y = 1483.83997 Z = 1.55000 rX = -8.00000 rY = 0.00000 rZ = -64.82000 DrawDistance = 0.0 = 0.00000, result = 4);
You can see that the output is pretty well detailed.

The calls can also include streamer plugin calls, as long as the plugin is set to be loaded after the streamer (put ExecLogger at the end of plugin server.cfg line), this also works with other plugins that call sa-mp natives.

With detailed list of calls you are sending to sa-mp, you can optimize your script better. It will help you find redundant calls, unused code, wrong data, etc.. it also works well in tandem with Zeex's crashdetect plugin - you can see which sa-mp natives were made before the crash, and that helps you locate the problem in your code when there is no crashdetect stack trace)

Thanks to: Zeex, BlueG.

Be advised, that this is a 0.3C version - it will probably work in 0.3D - it is not tested there, so try it but in theory it should work directly.

Download for windows:
http://www.mathpudding.com/topsecretsamp/ExecLogger.rar

Download for linux:
http://www.mathpudding.com/topsecret...gger_linux.rar

IF YOU DO NOT UNDERSTAND WHAT THIS PLUGIN DOES, DO NOT JUST INSTALL IT BLINDLY FOR NO GOOD REASON, ESPECIALLY ON A LIVE SERVER - THIS IS FOR LOCAL TESTING ONLY.

source code (copy into examples folder of Zeex's plugin SDK and compile with code::blocks or make):
http://www.mathpudding.com/topsecret...Logger_src.rar
__________________


samp://198.50.173.59:7777 - Partyserver - TurtleServer (now with extra turtles)!

SA-MP map editor: Not a in-game script but a proper windows application!
http://forum.sa-mp.com/showthread.php?t=282801

Last edited by JernejL; 23/10/2011 at 01:47 PM.
JernejL is offline   Reply With Quote
Old 22/10/2011, 08:11 PM   #2
RyDeR`
High-roller
 
RyDeR`'s Avatar
 
Join Date: Feb 2009
Location: Belgium
Posts: 3,133
Reputation: 645
Default Re: Execution Logger (0.3C version)

Nice work, will check it out.
__________________

Sup?
RyDeR` is offline   Reply With Quote
Old 22/10/2011, 08:19 PM   #3
Dark_Kostas
Gangsta
 
Join Date: Dec 2007
Location: Greece, Athens
Posts: 772
Reputation: 14
Default Re: Execution Logger (0.3C version)

Quote:
Originally Posted by JernejL View Post
i am sure that a lot of you spent many sessions placing and removing printf calls all around code while trying to debug complex bugs and issues in your scripts
Like 5 print(f) to a 10 line code; happened unlimited times!
Thanks for the plugin it will be really useful for debuging.
__________________
Quote:
Help != Scripting for you.

Give a man a fish he eats for a day, teach a man to fish he eats for a life time.
Dark_Kostas is offline   Reply With Quote
Old 22/10/2011, 08:22 PM   #4
Whitetiger
Huge Clucker
 
Whitetiger's Avatar
 
Join Date: Nov 2007
Location: Greenville, NC, USA
Posts: 418
Reputation: 76
Default Re: Execution Logger (0.3C version)

nice, will use it.
__________________
AutoArena EU
GitHub

Whitetiger is offline   Reply With Quote
Old 22/10/2011, 08:37 PM   #5
wups
High-roller
 
wups's Avatar
 
Join Date: Apr 2010
Location: Lithuania
Posts: 1,368
Reputation: 132
Default Re: Execution Logger (0.3C version)

Doesn't log Get*** Functions(Well at least GetVehicleParams).
wups is offline   Reply With Quote
Old 22/10/2011, 08:43 PM   #6
GangsTa_
High-roller
 
GangsTa_'s Avatar
 
Join Date: May 2010
Location: Republic of Moldova
Posts: 1,149
Reputation: 51
Default Re: Execution Logger (0.3C version)

I didn't really understand, how this is going to be useful?
__________________
Gigabyte GA-970A-D3
AMD FX-6300 3.5GHz 14MB AM3+
Zalman CNPS10X Cooler
Crucial 8,00GB (2x4GB) DDR3 PC3-10600 Ballistix Sport
XFX Radeon R9 270X 2GB GDDR5 256-bit 1000/5600
Western Digital Black 500GB 7200rpm 16MB SATA-III
Zalman Z9 Plus Black ATX
Zalman ZM500-LE 500W
GangsTa_ is offline   Reply With Quote
Old 22/10/2011, 08:48 PM   #7
Ricop522
High-roller
 
Ricop522's Avatar
 
Join Date: Feb 2010
Location: ES
Posts: 2,696
Reputation: 149
Default Re: Execution Logger (0.3C version)

Thanks, useful for me
__________________
"Any fool can write code that a
computer can understand. Good
programmers write code that
humans can understand."

Sistemas de Informação, IFES
Ricop522 is offline   Reply With Quote
Old 22/10/2011, 08:51 PM   #8
raz0x
Little Clucker
 
Join Date: Sep 2011
Posts: 5
Reputation: 0
Default Re: Execution Logger (0.3C version)

i need for linux!!
raz0x is offline   Reply With Quote
Old 22/10/2011, 09:34 PM   #9
Hiddos
High-roller
 
Hiddos's Avatar
 
Join Date: Sep 2008
Posts: 3,928
Reputation: 1851
Default Re: Execution Logger (0.3C version)

Quote:
Originally Posted by wups View Post
Doesn't log Get*** Functions(Well at least GetVehicleParams).
Quote:
This excludes the GetPlayerxxx, IsPlayerxxx and a few other functions on purpose, as the functions which retrieve data from sa-mp aren't as important as those that SET it
OT: Looks great for debugging!
__________________
Don't PM me.
Quote:
Originally Posted by DeWolf View Post
For fuck's sake people, this whole thread is fucked up now.
Hiddos is offline   Reply With Quote
Old 22/10/2011, 09:51 PM   #10
JernejL
Beta Tester
 
JernejL's Avatar
 
Join Date: Jan 2006
Location: Slovenia
Posts: 569
Reputation: 368
Default Re: Execution Logger (0.3C version)

Quote:
Originally Posted by wups View Post
Doesn't log Get*** Functions(Well at least GetVehicleParams).
It's like that on purpose, the spam with those function is HUGE, but it's supported in plugin code and can be enabled if you recompile it.

Quote:
Originally Posted by GangsTa_ View Post
I didn't really understand, how this is going to be useful?
Are you a scripter?

raz0x: are you a linux scripter?

Linux build: http://www.mathpudding.com/topsecret...gger_linux.rar
__________________


samp://198.50.173.59:7777 - Partyserver - TurtleServer (now with extra turtles)!

SA-MP map editor: Not a in-game script but a proper windows application!
http://forum.sa-mp.com/showthread.php?t=282801
JernejL is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Execution of bad players MarkoniGHS Screenshots and Videos 1 11/04/2011 01:04 AM
[AddPlayerClass] 210 Skins // Quicky1995 Logger Quicky1995 Help Archive 8 30/05/2010 04:16 AM
[FilterScript] [FS] RCON Logger _[HuN]_Epsilon_ Filterscripts 4 03/02/2010 04:29 PM
Logger Beer Advert [GTA:SA] matiiss223 Screenshots and Videos 5 27/12/2009 04:25 PM
ip logger Commander_Shaw Help Archive 5 14/03/2009 08:17 AM


All times are GMT. The time now is 08:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.