Skip to content

Commit

Permalink
Restore CFString code
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-webb committed Aug 4, 2023
1 parent aaf0ca6 commit 0101dba
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/include/log4cxx/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ class LOG4CXX_EXPORT Logger :
void log(const LevelPtr& level, const CFStringRef& message,
const log4cxx::spi::LocationInfo& location) const;
/**
Add a new logging event containing \c message and \c location to the appenders attached to this logger if this logger is enabled for \c level events.
Add a new logging event containing \c message to the appenders attached to this logger if this logger is enabled for \c level events.
This is the most generic printing method. It is intended to be
invoked by <b>wrapper</b> classes.
Expand Down
4 changes: 4 additions & 0 deletions src/test/cpp/helpers/messagebuffertest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include <log4cxx/logstring.h>
#include <log4cxx/helpers/loglog.h>

#if LOG4CXX_CFSTRING_API
#include <CoreFoundation/CFString.h>
#endif

using namespace log4cxx;
using namespace log4cxx::helpers;

Expand Down
18 changes: 18 additions & 0 deletions src/test/cpp/leveltestcase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "logunit.h"
#include <log4cxx/helpers/loglog.h>

#if LOG4CXX_CFSTRING_API
#include <CoreFoundation/CFString.h>
#endif

using namespace log4cxx;

LOGUNIT_CLASS(LevelTestCase)
Expand All @@ -36,6 +40,9 @@ LOGUNIT_CLASS(LevelTestCase)
#endif
#if LOG4CXX_UNICHAR_API
LOGUNIT_TEST(testUniCharStringToTrace);
#endif
#if LOG4CXX_CFSTRING_API
LOGUNIT_TEST(testCFStringToTrace);
#endif
LOGUNIT_TEST(testTrimmedToTrace);
LOGUNIT_TEST_SUITE_END();
Expand Down Expand Up @@ -115,6 +122,17 @@ LOGUNIT_CLASS(LevelTestCase)
}
#endif

#if LOG4CXX_CFSTRING_API
/**
* Tests Level.toLevel(CFSTR("TRACE"));
*/
void testCFStringToTrace()
{
LevelPtr trace(Level::toLevel(CFSTR("TRACE")));
LOGUNIT_ASSERT(trace->toString() == LOG4CXX_STR("TRACE"));
}
#endif

/**
* Tests Level.toLevel("TRACE ");
*/
Expand Down
4 changes: 4 additions & 0 deletions src/test/cpp/streamtestcase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include <log4cxx/stream.h>
#include <log4cxx/helpers/loglog.h>

#if LOG4CXX_CFSTRING_API
#include <CoreFoundation/CFString.h>
#endif

using namespace log4cxx;
using namespace log4cxx::helpers;
using namespace std;
Expand Down

0 comments on commit 0101dba

Please sign in to comment.