[SOLVED] Suppress "Loading <model>" message in c++

Hey, reposting this question to c++ because I’m looking for someone that has managed to get this working in c++. Python people were helpful, but I haven’t seen a working solution in c++.

I want to suppress these messages because I’m loading hundreds of models and want to clean up my terminal for higher level warnings, errors, etc. And ideally I don’t want to recompile panda.

In the config.prc, i’ve set notify-level to warning, but still get "Loading " messages.
Same goes when i use notify-output <example.out>.

I believe something here may also work http://www.panda3d.org/manual/index.php/Log_Messages
but there is no c++ example.

Any help would be awesome, thanks!

okay so i spent some time and got a solution for you.

		std::ofstream myfile;
		myfile.open ("log.txt");
		Notify::ptr()->set_ostream_ptr(&myfile,0);

this will put everything into a file of your liking.Note that all nout usages will be put into the file now.You can still use cout and cerr or printf normally for your own stuff.

		std::ostream *no = new fstream;
		Notify::ptr()->set_ostream_ptr(no,0);

Thats a blank stream if you didnt want nout to do anything.
NOTE;
Im didnt try the config.prc settings.
i think you might have to put 1 as that second variable if you are going to replace it later.

I’ll check in a fix for 1.8.2 that makes the "Loading " message go through the notify system instead of going straight to nout.

Thanks Pataua101, this does work! Of course it would be nice to still see assertion fails and such on the terminal, but this will do for now until version 1.8.2 (thanks rdb).