Mercurial > hg > orthanc
comparison UnitTests/main.cpp @ 102:7593b57dc1bf
switch to google log
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 03 Oct 2012 16:28:13 +0200 |
parents | 428784e59dcd |
children | 3b45473c0a73 |
comparison
equal
deleted
inserted
replaced
101:428784e59dcd | 102:7593b57dc1bf |
---|---|
279 printf("[%s]\n", Toolbox::GetDirectoryOfExecutable().c_str()); | 279 printf("[%s]\n", Toolbox::GetDirectoryOfExecutable().c_str()); |
280 } | 280 } |
281 | 281 |
282 | 282 |
283 | 283 |
284 #include "../Core/Logging.h" | 284 #include <glog/logging.h> |
285 | |
286 #if DCMTK_BUNDLES_LOG4CPLUS == 0 | |
287 #include <log4cplus/consoleappender.h> | |
288 #include <log4cplus/fileappender.h> | |
289 #include <log4cplus/configurator.h> | |
290 #else | |
291 #include <dcmtk/oflog/consap.h> | |
292 #include <dcmtk/oflog/fileap.h> | |
293 //#include <dcmtk/oflog/configurator.h> | |
294 #endif | |
295 | |
296 | |
297 static log4cplus::Logger logger(log4cplus::Logger::getInstance("UnitTests")); | |
298 | 285 |
299 TEST(Logger, Basic) | 286 TEST(Logger, Basic) |
300 { | 287 { |
301 LOG4CPP_INFO(logger, "I say hello"); | 288 LOG(INFO) << "I say hello"; |
302 } | 289 } |
303 | 290 |
304 | 291 |
305 int main(int argc, char **argv) | 292 int main(int argc, char **argv) |
306 { | 293 { |
307 using namespace log4cplus; | 294 // Initialize Google's logging library. |
308 SharedAppenderPtr myAppender(new ConsoleAppender()); | 295 FLAGS_logtostderr = true; |
309 //SharedAppenderPtr myAppender(new FileAppender("UnitTests.log")); | 296 google::InitGoogleLogging("Orthanc"); |
310 #if DCMTK_BUNDLES_LOG4CPLUS == 0 | |
311 std::auto_ptr<Layout> myLayout(new TTCCLayout()); | |
312 #else | |
313 OFauto_ptr<Layout> myLayout(new TTCCLayout()); | |
314 #endif | |
315 myAppender->setLayout(myLayout); | |
316 Logger::getRoot().addAppender(myAppender); | |
317 Logger::getRoot().setLogLevel(INFO_LOG_LEVEL); | |
318 | 297 |
319 OrthancInitialize(); | 298 OrthancInitialize(); |
320 ::testing::InitGoogleTest(&argc, argv); | 299 ::testing::InitGoogleTest(&argc, argv); |
321 int result = RUN_ALL_TESTS(); | 300 int result = RUN_ALL_TESTS(); |
322 OrthancFinalize(); | 301 OrthancFinalize(); |