Little known thing I provide for my servers is chat logging to a website:
http://entropy.me.uk/simutrans/server/sim64/2012/03/05.htmlI do this by piping the stdout/stderr output of Simutrans through the Unix utility logger and into syslog. I then have a syslog rule which matches the chat log network messages and puts them into a separate log file. This log file is then parsed by a python script into a CSV format file, which is then finally processed into HTML by another script.
Following Dwachs' patch which adds the concept of Player nicknames these logging messages seem to have vanished.
I think I'd like to simplify my life a bit by simply having the game log this information directly in CSV format. This would be output to stdout, and have some unique tag so that syslog can parse the data out. I *don't* want Simutrans to log to a file itself (at least not without making it either log to syslog, or be capable of responding to a SIGHUP by re-opening its log files).
At present I am going to implement the following messages (CSV formatted):
Chat messages (type 'chat'): (done)
Type, ClientID, IPAddress, Player Name, Company ID, Company Name, Message
Player changed name message (type 'namechange'): (done)
Type, ClientID, IPAddress, Old Player Name, New Player Name
Player Connected (type 'connect'): (done)
Type, ClientID, IPAddress, Player Name
Player Disconnected (type 'disconnect'): (done)
Type, ClientID, IPAddress, Player Name
Admin message (type 'adminmsg') - sent via nettool: (done)
Type, Message
Private message (type 'private') - (whisper, sent from one client to another): (done)
Type, ClientID, IPAddress, Player Name (from), Company ID, Company Name, Player Name (to), Message
All will be prefixed in log output by the string: __ChatLog__ followed by the message, to give me something to look for. Timestamping can be easily provided by syslog so I'm not going to include a timestamp myself in the output.
Any suggestions as I work on this?