Conduit's APIs emit three types of messages for logging and error handling:
Message Type | Description |
---|---|
Info |
|
Warning |
|
Error |
|
Conduit provides a default handler for each message type:
Message Type | Default Action |
---|---|
Info |
|
Warning |
|
Error |
|
The conduit::utils namespace provides functions to override each of the three default handlers with a method that provides the following signature:
void my_handler(const std::string &msg,
const std::string &file,
int line)
{
// your handling code here ...
}
conduit::utils::set_error_handler(my_handler);
Here is an example that re-wires all three error handlers to print to standard out:
../../tests/docs/t_conduit_docs_tutorial_examples.cpp
../../tests/docs/t_conduit_docs_tutorial_examples.cpp
t_conduit_docs_tutorial_examples_out.txt
The default handlers are part of the conduit::utils interface, so you can restore them using:
../../tests/docs/t_conduit_docs_tutorial_examples.cpp