Log in

View Full Version : Enhanced logging



XtrmJosh
12-04-2012, 06:34 PM
So the logging feature has been added (possibly one of my most necessary features, I'll use this more than anything!)

It would be nice to see log files like this:

[Timestamp] called depotdeposit(1234, 5678, {1, 1234}) from XenoLuaLib.lua with return true
[Timestamp] called closewindows() from MyScript.lua with return false
[Timestamp] connection to game server lost
[Timestamp] client closed

If a function returns null, 0, or false, more data on where it went wrong would be useful, aka the escape line number of the file which the function exists in (aka for 2nd log entry above, line 50 of file MyScript.lua then perhaps even the line of code including, if necessary, the function called from that location with any parameters in place).

This would be really nice for testing & producing scripts more quickly and efficiently. It could also be an option in the looter, targeting, walker, healer, etc to log events... Not sure what your internal functions are named, but I think I've seen a bit of source on your VLogs, showing that they are sensible...

[Timestamp] called say('exura') from healWorkerThread while gethealth() returned 100 and getmana() returned 20

And so on, for targeting it might be nice just to see when it is switching target, and the requirements which were met in order to allow it to... E.g:

[Timestamp] attacking Ghoul due to no current target
[Timestamp] attacking Skeleton due to priority of Skeleton higher than priority of Ghoul
[Timestamp] using item 1234 because creaturecount("Ghoul") is higher than 3

And so on.

Hope I didn't drag this out too much. Logging is really useful, and it could be a really good feature to have!

DarkstaR
12-04-2012, 06:37 PM
I'm honestly not sure if Lua lets me follow control flow like this.

XtrmJosh
12-04-2012, 08:34 PM
If it doesn't you should switch the engine to run python haha

I use python at work and it's soooooo nice when you see callbacks from like 4 levels up through a very complex file hierarchy, including parameters submitted and everything...

On a serious note though I think it should, even if it doesn't, it would definitely be nice to see as much information as possible in the logs. Logs are supposed to be messy & difficult to decipher, since they are aimed at developers & tradesmen, not at end users...

Your bot, so your decision, but I'm sure we can agree, logs are any developers best friend. Cause you can't see electronics, the only way to monitor them is through logs!

hoodnasty
12-05-2012, 10:21 AM
Looks cool, wouldn't hurt!