I'm writing a Python tool to parse a log file from game server. The log file is of format:
ms:classname::id::method::arg1::arg2....
There are a lot of classes, and a lot of methods for each class, and each of them has its own format (number and meaning of arguments). I want to reconstruct the game (or at least relevant parts of it) from the log. I thought about doing something like this:
- Creating a .format file where the formats of all the files are listed.
- Each time I'll read the log, I'll analyze the format file, and create a dictionary of dictionaries - each class will have its own dictionary of methods, and the dictionary of each method would contain the args as a list. Then, each time I read a line, I'll check the dictionary for the format of the needed method of the needed class, and parse the line accordingly, and create some field-value dictionary structure to contain the information.
This seems reasonable, but I don't want to reinvent the wheel - I'm sure someone have thought about this already... Any smarter way to do it? Any shortcuts that could save me some work, or python tools that do something similar?
ms:classname::id::
.) That aside, the logs don't capture concepts like intermediate computations, return values, or scope, so I think you'll have a hard time extracting any logic from it that you can't already plainly see for yourself by looking at the logs. – Doval Jan 8 at 17:20