Changeset 7fff6c


Ignore:
Timestamp:
Feb 14, 2011, 10:10:40 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Children:
d3926b5
Parents:
2d6ae0
git-author:
Frederik Heber <heber@…> (02/14/11 22:07:29)
git-committer:
Frederik Heber <heber@…> (02/14/11 22:10:40)
Message:

Default Assert behavior is Abort, not Ask. Added LOG() macro.

  • Library version is now 4:0:3, API version is still 1.0.8.
  • default behavior of Abort is more approriate, e.g. for unit tests are much more abundant that main (interactive) programs.
  • added ELOG(), LOG() macro in place for DoLog(x) && (Log() << Verbose ...
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r2d6ae0 r7fff6c  
    33
    44AC_PREREQ([2.65])
    5 AC_INIT([CodePatterns], [1.0.7], [heber@ins.uni-bonn.de], [codepatterns], [http://trac.ins.uni-bonn.de/projects/CodePatterns/])
     5AC_INIT([CodePatterns], [1.0.8], [heber@ins.uni-bonn.de], [codepatterns], [http://trac.ins.uni-bonn.de/projects/CodePatterns/])
    66AC_CONFIG_AUX_DIR(config)
    77AC_CONFIG_SRCDIR([src/Patterns/Singleton_impl.hpp])
     
    2525# refer to the libtool manual, section "Updating library version information":
    2626# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
    27 AC_SUBST([CODEPATTERNS_SO_VERSION], [4:0:2])
    28 AC_SUBST([CODEPATTERNS_API_VERSION], [1.0.7])
     27AC_SUBST([CODEPATTERNS_SO_VERSION], [4:0:3])
     28AC_SUBST([CODEPATTERNS_API_VERSION], [1.0.8])
    2929
    3030# Checks for libraries.
  • src/Helpers/Assert.cpp

    r2d6ae0 r7fff6c  
    6666#endif
    6767
    68 Assert::Action Assert::_my_assert::defaultAction = Ask;
     68Assert::Action Assert::_my_assert::defaultAction = Abort;
    6969std::vector<Assert::hook_t> Assert::_my_assert::hooks;
    7070
  • src/Helpers/Log.hpp

    r2d6ae0 r7fff6c  
    1616#include "errorlogger.hpp"
    1717#include "logger.hpp"
     18#include "Verbose.hpp"
     19
     20#define LOG(level,msg) DoLog(level) && (Log() << Verbose(level) << msg << std::endl)
     21#define ELOG(level,msg) DoeLog(level) && (eLog() << Verbose(level) << msg << std::endl)
    1822
    1923class logger & Log();
  • src/unittests/LogUnitTest.cpp

    r2d6ae0 r7fff6c  
    5353{
    5454  logger::getInstance().setVerbosity(2);
     55  // long form
    5556  DoLog(0) && (Log() << Verbose(0) << "Verbosity level is set to 2." << endl);
    56   DoLog(0) && (Log() << Verbose(0) << "Test level 0" << endl);
    57   DoLog(1) && (Log() << Verbose(1) << "Test level 1" << endl);
    58   DoLog(2) && (Log() << Verbose(2) << "Test level 2" << endl);
    59   DoLog(3) && (Log() << Verbose(3) << "Test level 3" << endl);
    60   DoLog(4) && (Log() << Verbose(4) << "Test level 4" << endl);
     57  // shortform via macro
     58  LOG(0,"Test level 0");
     59  LOG(1,"Test level 1");
     60  LOG(2,"Test level 2");
     61  LOG(3,"Test level 3");
     62  LOG(4,"Test level 4");
    6163
    6264  DoLog(0) && (Log() << Verbose(0) << "Output a log message." << endl);
    6365  DoeLog(0) && (eLog()<< Verbose(0) << "Output an error message." << endl);
     66  CPPUNIT_ASSERT(DoLog(0));
    6467  setVerbosity(3);
    6568  DoLog(4) && (Log() << Verbose(4) << "This should not be printed." << endl);
    6669  DoeLog(4) && (eLog()<< Verbose(4) << "This should not be printed." << endl);
     70  CPPUNIT_ASSERT(!DoLog(4));
     71  CPPUNIT_ASSERT(!DoeLog(4));
    6772};
Note: See TracChangeset for help on using the changeset viewer.