errstr << "the index is out of range: " << i << Sas::error("indexOutOfRange");
errstr << "the file " << filename << " will be overwritten" << Sas::warning("overWriteFile");
errstr << "invalid null pointer: " << p << Sas::fatal("invalidPointer");
When only a text message is needed, a simple call suffices:
Sas::error("invalidIndex","The index was out of range");
and similar for the other error levels.
Messages are generated in a similar way, e.g.:
errstr << "processing input from " << fileName << Sas::message(Msg::App,Msg::Verbose);
When only a text message is needed, a simple call suffices:
Sas::message(Msg::App,Msg::Sparse,"processing input");
The following layer are available: Msg::UI, Msg::MetaApp, Msg::App, Msg::AppLib, Msg::Lib, Msg::Core, Msg::Kernel.
The following verbosity levels are available: Msg::Sparse, Msg::Verbose, Msg::Noisy.
The verbosity level can be inquired from the err object with the verbosity member function. This can be used to prevent the overhead of setting up complex debug messages which will never be written anyway. E.g.:
if (errHandler.verbosity(Msg::App) >= Msg::Verbose)
for (unsigned i = 0; i < 100; ++i)
errstr << a(i) << Sas::message(Msg::App,Msg::Verbose);