00001 #include "nasa_common_logging/Logger.h" 00002 00003 int main(int argc, char** argv) 00004 { 00005 // NasaCommonLogging::Logger examples 00006 // keep log messages to a single line (no \n), otherwise logfiles get wonky. don't end a message with a newline either. 00007 00008 // use log() for simple messages 00009 // requires a category that describes the source of the log message, then a severity level, then a standard std::string message. 00010 NasaCommonLogging::Logger::log("gov.nasa.nasa_common_logging.logdemo", log4cpp::Priority::WARN, "This is a warning!"); 00011 00012 // use getCategory() for streamed messages 00013 // requires a category that describes the source of the log messages, then a severity level, then any number of stream objects 00014 NasaCommonLogging::Logger::getCategory("gov.nasa.nasa_common_logging.logdemo") << log4cpp::Priority::ERROR << "This is error: " << 42; 00015 00016 return 0; 00017 }