Archived

This topic is now archived and is closed to further replies.

Metron

Event logging

Recommended Posts

Metron    268
Hi, I''m creating a system (engine) where the different components are PlugIn based. What I would like to do now is to have a general log file (or log window) where different events are logged. I''m thinking of something like the log window that is opened once Q3 or STV:EF are started. I''ve been thinking of it and I struggled upon the idea that I would have to pass the log instance to every component of the system. Has anyone implemented such a logging system which is able to log events from different components such as DLLs ? Kind regards, Metron

Share this post


Link to post
Share on other sites
Shannon Barber    1681
Rather than pass a log instance to each plug-in, you could provide a function that acquires a pointer to the console/log singleton. You pass something to the plug-ins don''t you? Like a pointer to the current instance of the game?

Share this post


Link to post
Share on other sites
Metron    268
I do not pass a pointer to the game to the plug-in because I want them to be reusable. I also wanted to avoid passing a pointer to the plug-in but I had some serious thoughts about it the last couple of days and I think that I cannot avoid it.

I think I stick with this idea: I put a function into the plug-in that allows me to set a log class interface to that plug-in. Since the plug-in only get''s a pointer to a pure virtual class, the implementation etc. can be independent of the game and of the type of logging.

I also would have the control to which plug-in logs and which don''t...

The way how the game logs the events can be programmed within the game by overloading (see implementing) the pure virtual class...

Share this post


Link to post
Share on other sites