Team-Silver-Sphere / SquadJS

Squad Server Script Framework
Boost Software License 1.0
167 stars 128 forks source link

Extend db_log event logging #181

Open Hamburgergamer opened 3 years ago

Hamburgergamer commented 3 years ago

What is the issue, e.g. map voting, you would like to solve?

The db_log plugin is currently not logging every available events from log-parser. When I create database request for player statistics, I often miss data to order players based on playtime or selected role. It would be great, if the db-log plugin would also log player-connected, player-disconnected, player-possess and player-un-possess events. Some server owners might not want to spam their databases with this data, so it should be configurable within the setting.

How would you like us to solve this issue?

As a quick fix, these events could be logged as raw data in a separate table for each event. My preferred solution would be combining player-connected and player-disconnected in a "session" table like:

|| sessionID || steamID || connected || disconnected || playtime ||

The "playtime" value would be calculated time between the connect and the disconnect. This would allow dscord bots like SquadStats to also display the time a player played on the server.

For player-possess and player-un-possess it would be already great to just log all the data somewhere to check for which use-cases this values could be useful.

Additional Info

It would be awesome, if the existing tables DBLog_deaths, DBLog_Wounds, DBLog_Revives could include the MatchID. This makes it easier to identify when a specific event happened.

milutinke commented 3 years ago

I have already done a similar thing with the plugin 7 days ago, but I wanted to test it properly. That is why I've added the PLAYER_DISCONNECTED event in my last commit.

Here is what it looks like: image image

Here is the info that I am logging: image

I will commit it soon. Edit: PS: Do not mind the NULL values, those are just because I've started the bot during the match, so I had no previous recorded data of players from PLAYER_CONNECTED event.

Hamburgergamer commented 3 years ago

@milutinke that looks really awesome and is exactly what I am looking for. It will make the insights from the database a lot easier to compare. I hope that it will find its way to the master branch quickly.

milutinke commented 3 years ago

@milutinke that looks really awesome and is exactly what I am looking for. It will make the insights from the database a lot easier to compare. I hope that it will find its way to the master branch quickly.

Well, Thomas seems to be busy, so you might wait a little longer. In the meantime, you can try out my fork and modify it for your needs.