Ignore:
Timestamp:
Dec 13, 2011, 10:45:00 AM (14 years ago)
Author:
Frederik Heber <heber@…>
Children:
d85532
Parents:
40f2e6
git-author:
Frederik Heber <heber@…> (12/02/11 13:05:49)
git-committer:
Frederik Heber <heber@…> (12/13/11 10:45:00)
Message:

Modified ObserverLog: Singleton and both output to screen and internal Log.

  • ObserverLog can now either be printed concurrently or later requested as string (e.g. on exit as has been done before). This should ease debugging Observer code.
  • enable/disableLogging() (dis)activate printing to screen.
  • ObserverLog is now a true singleton.

Details:

  • Implemented helper class ObserverLog::Log which is returned as boost::shared_ptr on addMessage() and can be streamed to.
  • On dstor the logged message is appended with endl, placed into ObserverLog's internal log and printed on screen if enableLogging().
  • NOTE: streaming std::endl is not working, and not necessary.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Patterns/Observer/unittests/ObserverUnitTest.cpp

    r40f2e6 r2c11c1  
    3131#include "Observer/ObservedContainer.hpp"
    3232#include "Observer/ObservedContainer_impl.hpp"
     33#include "Observer/ObserverLog.hpp"
    3334
    3435#include "ObserverUnitTest.hpp"
     
    4849void ObserverTest::setUp() {
    4950  ASSERT_DO(Assert::Throw);
     51
    5052  simpleObservable1 = new SimpleObservable();
    5153  simpleObservable2 = new SimpleObservable();
     
    8486  delete notificationObserver1;
    8587  delete notificationObserver2;
     88#ifdef LOG_OBSERVER
     89  ObserverLog::purgeInstance();
     90#endif
    8691}
    8792
Note: See TracChangeset for help on using the changeset viewer.