How do I make proper use of Logging.h?

I am new to PyTorch coding. I am writing algorithms in C++. I would like to log their progress using the logging infrastructure provided with PyTorch. There is code for logging in c10/util/Logging.h. The coding style looks like this:

#include <c10/util/Logging.h>

VLOG(0) << “Hello world! \n”;

The above code works, in that it compiles. And no printout is produced.

Details. The code I wrote is added as a module to a PyTorch python script. So the question is how does one manipulate the PyTorch logging infrastructure?

How do I turn on the log printout? How do I control where it goes?

Many thanks for any hints!

1 Like

You can take a look at this and step in:

But this logging header is mainly for internal use, the underlying is actually very similar to glog, you can use glog directly actually.

Thanks for your reply. I decided to take a very small subset of the code in “logging_is_not_google_glog.h”, and write a tiny logger for my functions.