Original Post
i'm a little confused about logging stuff. this is how i do logging: I have a main app class with pointers to other classes. Inside each of those other classes i have an ofstream object and a Logger class that does all the logging. Ofstream object is initialized from main app class and logger is initialized from this ofstream object. The benifit is that every class in main app class can have their own log file. The disadvantage is that every class needs to worry about dealing with logging which is not very good. Also there's this problem: if a class inside main app class has another class inside of it, this other class cannot use the logger. like so:
class App
{
class Obj
{
Logger logg;
class Obj2 {} * obj2; //obj2 cannot use logg
} * obj;
};
How should i deal with all of this? Is having a logger object inside of every class the answer? I would like to know how to design effective logging classes. thanks!