lotharious
MIS
Im looking for a way to pass variable arguments by overloading the << operator.
Basically, making a cout function that has a parameter passed to it.
I know how to do this with stdarg/varargs however this isnt the functionality I am looking for.
I have a class that is going to handle logging for a growing application.
This logging class handled multiple different types of log messages. There are 2 functions in this class that I need to access the overloaded operator.
Log and Debug.
The end result would be doing something like this...
char v[1024];
LOG lp(..);
sprintf(v, "my log message");
lp.Log(ERROR, v);
Im basically looking to move those 2 together with the overload operator so I would be able to do something like this.
lp.Log(ERROR) << "my log message";
How do I go about doing this? and/or Where can I find some help docs on this. I have yet to find any.
Basically, making a cout function that has a parameter passed to it.
I know how to do this with stdarg/varargs however this isnt the functionality I am looking for.
I have a class that is going to handle logging for a growing application.
This logging class handled multiple different types of log messages. There are 2 functions in this class that I need to access the overloaded operator.
Log and Debug.
The end result would be doing something like this...
char v[1024];
LOG lp(..);
sprintf(v, "my log message");
lp.Log(ERROR, v);
Im basically looking to move those 2 together with the overload operator so I would be able to do something like this.
lp.Log(ERROR) << "my log message";
How do I go about doing this? and/or Where can I find some help docs on this. I have yet to find any.