08.02.2019, 20:32
If you are planning to create a log viewing interface for your admins on your website or somewhere else, a database is 100% the way to go. I recently built a general purpose logging service in golang (and a client for SA-MP), I'm not going to get into the details since it's an overkill for SA-MP with its queue system needed for checksum chaining, but leaving that out, something similar is fairly easy to implement in PAWN. It might be tempting to just create a table for each log with the necessary parameters (I also fell into that trap years ago), but it makes the process of creating a viewing interface much more complex and time-consuming. Instead of that, my logger is using a fully normalised database model that stores the log types in one table, the parameters associated with them in another, the log rows in another and the parameters associated with them in another. Here is my database model:
It's far from perfect, for example all values are stored as strings (with a limited length, 256 should be enough from everything sent from SA-MP though) and the parameters are missing foreign keys to non-log-related tables, even though they could be useful in some cases. It is a lot better than hardcoding the tables and their columns, though.
MySQL is easily capable of handling large amounts of data, take a look at the companies using it, they are far more demanding than a single SA-MP server. It will also not cause any performance issues with the SA-MP server itself, once the query is dispatched, the server will not expect any response from the database.
It's far from perfect, for example all values are stored as strings (with a limited length, 256 should be enough from everything sent from SA-MP though) and the parameters are missing foreign keys to non-log-related tables, even though they could be useful in some cases. It is a lot better than hardcoding the tables and their columns, though.
Quote:
MySQL? Really. You're going to send a huge amount of logs each time? You'll need also lots of tables, the plugin is far more optimistic and better.
|