Closed sebasobotka closed 6 years ago
Hi, thanks for the tip.
I've used that in the past but found that it only returned the name of the function and not the name of the class. An alternative is:
ofLogNotice(__PRETTY_FUNCTION__) << "Hello";
But that gives the return type and all method parameters, so it's a bit much. Anyway, thanks for the feedback.
CB
Oh, also, the reason I use the class::method approach is because you can selectively turn on and off logging based on that string, so it makes it easier to selectively turn logging on / off if you can see the name of the module before pre-processing.
I am working on Windows (Visual Studio) and __FUNCTION__
returns class::method
and even namespace::class::method
and that's the reason why I wrote about it.
Thanks for the info about settings the logging level.
I checked it and it doesn't work with __FUNCTION__
.
Also, this doesn't work:
ofApp::setup
ofSetLogLevel(OF_LOG_NOTICE);
ofSetLogLevel("myClass", OF_LOG_VERBOSE);
class method
ofLogVerbose("myClass::setup") << "something";
This works only in my case.
ofApp::setup
ofSetLogLevel(OF_LOG_NOTICE);
ofSetLogLevel("myClass", OF_LOG_VERBOSE);
class method
ofLogVerbose("myClass") << "something";
Hi, I noticed that you've changed the log messages recently. I found that
ofLog***(__FUNCTION__)
does the job. best regards