[Plugin] Execution Logger (0.3C version)
#1

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
Reply
#2

Nice work, will check it out.
Reply
#3

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.
Reply
#4

nice, will use it.
Reply
#5

Doesn't log Get*** Functions(Well at least GetVehicleParams).
Reply
#6

I didn't really understand, how this is going to be useful?
Reply
#7

Thanks, useful for me
Reply
#8

i need for linux!!
Reply
#9

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!
Reply
#10

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
Reply
#11

cool
Reply
#12

Nice one!!!
Reply
#13

Looks awesome, going to try it soon!
Reply
#14

Nice job
Reply
#15

I love it!! Good job!

A suggestion: Maybe output the logs in a different file? Or at least make an option to do it? That way the server log doesn't have to be spammed, as many servers use the server_log file for other purposes such as catching rule breakers, which would be harder if the plugin spams it.
Reply
#16

Holy cow, this is awesome! THANKS!
Reply
#17

I gonna use it
Reply
#18

Wow, really nice
Reply
#19

This will come in handy. Thanks a bunch!
Reply
#20

Pretty cool, i'm gonna try it out.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)