I'm starting to write an app that is similar to an IRC logger. Each log file will be based on three values or so -- user name, IP, and channel. The reason I have both user name and IP is so that I can keep track of what user names an IP uses or vice versa. I need the channel so the bot will be in multiple channels. I may add more values for each unique log file in the future.
For example, there will be 2 log files generated for user Foo, IP 126.96.36.199, channel 123 and for Foo, IP 188.8.131.52, channel 234.
What is an efficient way to generate a log file for each of these values? I thought about this for a while and all I can think of is to create a text file with three columns (one for each value) and every time the user talks, I check this text file and put their conversation in the appropriate log file. This requires file access every talk though, so it is not scalable.
Alternatively, I could just log everything in a single file and have another C app that splits up the conversation based on these three values. I'd like to implement both and see how major of a performance difference this is, but if you have more efficient ways, I'd love any feedback.