Better event logging OR time functions from os to the API
Posted: Fri Mar 24, 2017 4:45 pm
Are the chat etc. messages that were "recently" added (as mentioned in viewtopic.php?f=66&t=27197) not logged into the log file at all? I see them on the server console, but not in the factorio-current.log file.
I just spent a few hours looking into factorio modding, and I was trying to make a tiny mod that would simply log certain game events into a nice timestamped log file.
(I want these so that I can hook up factorio to my custom "game statistics" web page thingy that I have been using for Minecraft and Terraria.)
Unfortunately I hit a brick wall in that the io, and more importantly, the os module/library have been disabled in Factorio's Lua. So this means that I can't get the system time nor nicely format it :/
So would it be possible to add nicely formatted logging for "interesting game events", preferably in a separate log file that doesn't have the other verbose, and for this purpose, unnecessary noise that the server console normally has?
Interesting game events for my purposes would include:
Note that the current timezone has been added to the timestamp, so that daylight saving changes twice a year become unambigous too.
If this is out of scope for the game, then could I at least request that the relevant time functions from the os library be made available via the game's API?
For me it would include, at the very least, the following functions:
That might even be the better "solution", as that would allow me to develop that logging mod that I was going to make, and add a lot more functionality to it. I saw some people requesting logging of certain game events to deal with griefers etc. I could make a nice event logging mod that groups up actions, you could have configurable event types that you want to log etc. But I'd really want to have access to the system time and time formatting functions for those logging purposes.
Also, are there any relevant events I could use to log the server start and stop events? If not, could those events be added as well?
I just spent a few hours looking into factorio modding, and I was trying to make a tiny mod that would simply log certain game events into a nice timestamped log file.
(I want these so that I can hook up factorio to my custom "game statistics" web page thingy that I have been using for Minecraft and Terraria.)
Unfortunately I hit a brick wall in that the io, and more importantly, the os module/library have been disabled in Factorio's Lua. So this means that I can't get the system time nor nicely format it :/
So would it be possible to add nicely formatted logging for "interesting game events", preferably in a separate log file that doesn't have the other verbose, and for this purpose, unnecessary noise that the server console normally has?
Interesting game events for my purposes would include:
- server start
- server stop
- player join
- player quit
- player death
- rocket launched
Code: Select all
2017-03-24 18:15:24 +0200 [INFO] Server started
2017-03-24 18:15:24 +0200 [INFO] Player masa joined the game
2017-03-24 18:15:24 +0200 [INFO] Player masa died
2017-03-24 18:15:24 +0200 [INFO] Player masa left the game
2017-03-24 18:15:24 +0200 [INFO] A rocket was launched
2017-03-24 18:15:24 +0200 [INFO] Server stopped
If this is out of scope for the game, then could I at least request that the relevant time functions from the os library be made available via the game's API?
For me it would include, at the very least, the following functions:
Code: Select all
os.time()
os.difftime()
os.date()
Also, are there any relevant events I could use to log the server start and stop events? If not, could those events be added as well?