I am using C++ for about a year now and am comfortable with the basics
of the language but need some help here with finding a design pattern
for a problem I am trying to solve.
Basically I am trying to log events happening in different classes
(spread across different .cxx files). The events are in most cases
certain checks being done before accessing data from a database. I
need to log which check was done, whether it passed/failed, why it
passed/failed etc.
I am thinking of having a "event collector" class. I will then create
a single object of this class in my program. Then from the various
parts of my code I will call a function like eventCollector-
pushEventInfo(.....)
Now from different parts of the code I would be passing in different
amounts of information (e.g. a couple of strings from one function, a
bunch of int values from another etc). So I would overload the
pushEventInfo function to accept structs of the different types of
info I will be passing to the "event collector" class.