Changeset 141 in pacpusframework for branches/2.0-beta1/include/Pacpus


Ignore:
Timestamp:
Jul 30, 2013, 5:48:06 PM (11 years ago)
Author:
Marek Kurdej
Message:

Major update: using Boost.Log if PACPUS_USE_LOG is true.
Added: overloaded operator<< for QString (explicit instantiation).

Location:
branches/2.0-beta1/include/Pacpus/kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0-beta1/include/Pacpus/kernel/DbiteException.h

    r89 r141  
    4343    virtual const char* what() const throw();
    4444
    45 
    4645private:
    4746    std::string mWhat;
  • branches/2.0-beta1/include/Pacpus/kernel/Log.h

    r89 r141  
    2828public:
    2929    LogConfigurator();
    30     ~LogConfigurator();
    31 
    3230    static void configureLoggerWithFile(const char * configFilename);
    33 } initializer; // using Schwarz/nifty counter idiom for static initialization
     31} logInitializer;
    3432
    3533} // namespace pacpus
    3634
    37 #ifdef PACPUS_USE_LOG
    38   #include <log4cxx/logger.h>
     35#if defined(PACPUS_USE_LOG)
    3936
    40   class QString;
    41  
    42   #define DECLARE_STATIC_LOGGER(name) \
    43     static log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(name))
     37#include <boost/log/trivial.hpp>
     38#include <iosfwd>
     39class QString;
    4440
    45   #define LOG_TRACE(message)          LOG4CXX_TRACE(logger, message)
    46   #define LOG_DEBUG(message)          LOG4CXX_DEBUG(logger, message)
    47   #define LOG_INFO(message)           LOG4CXX_INFO(logger, message)
    48   #define LOG_WARN(message)           LOG4CXX_WARN(logger, message)
    49   #define LOG_ERROR(message)          LOG4CXX_ERROR(logger, message)
    50   #define LOG_FATAL(message)          LOG4CXX_FATAL(logger, message)
     41template< typename CharT, typename TraitsT >
     42PACPUSLIB_API std::basic_ostream< CharT, TraitsT >& operator<< (std::basic_ostream< CharT, TraitsT >& strm, QString const& s);
    5143
    52   /// Output stream ::log4cxx::helpers::CharMessageBuffer operator for QString
    53   PACPUSLIB_API ::log4cxx::helpers::CharMessageBuffer & operator<<(::log4cxx::helpers::CharMessageBuffer & os, const QString & s);
    54   /// Output stream ::log4cxx::helpers::MessageBuffer operator for QString
    55   PACPUSLIB_API ::log4cxx::helpers::CharMessageBuffer & operator<<(::log4cxx::helpers::MessageBuffer & os, const QString & s);
     44#define DECLARE_STATIC_LOGGER(name)
     45
     46#define LOG(level, message)         BOOST_LOG_TRIVIAL(level) << message
     47#define LOG_TRACE(message)          LOG(trace, message)
     48#define LOG_DEBUG(message)          LOG(debug, message)
     49#define LOG_INFO(message)           LOG(info, message)
     50#define LOG_WARN(message)           LOG(warning, message)
     51#define LOG_ERROR(message)          LOG(error, message)
     52#define LOG_FATAL(message)          LOG(fatal, message)
    5653
    5754#else
    58   /// Declares a log4cxx logger
    59   ///
    60   /// @param name Name of the logger, displayed when logging a message.
    61   #define DECLARE_STATIC_LOGGER(name)
    62   /// Logs a message at TRACE level using default logger
    63   #define LOG_TRACE(message)
    64   /// Logs a message at DEBUG level using default logger
    65   #define LOG_DEBUG(message)
    66   /// Logs a message at INFO level using default logger
    67   #define LOG_INFO(message)
    68   /// Logs a message at WARN level using default logger
    69   #define LOG_WARN(message)
    70   /// Logs a message at ERROR level using default logger
    71   #define LOG_ERROR(message)
    72   /// Logs a message at FATAL level using default logger
    73   #define LOG_FATAL(message)
     55
     56/// @param name Name of the logger, displayed when logging a message.
     57#define DECLARE_STATIC_LOGGER(name)
     58/// Logs a message at TRACE level using default logger
     59#define LOG_TRACE(message)
     60/// Logs a message at DEBUG level using default logger
     61#define LOG_DEBUG(message)
     62/// Logs a message at INFO level using default logger
     63#define LOG_INFO(message)
     64/// Logs a message at WARN level using default logger
     65#define LOG_WARN(message)
     66/// Logs a message at ERROR level using default logger
     67#define LOG_ERROR(message)
     68/// Logs a message at FATAL level using default logger
     69#define LOG_FATAL(message)
     70
    7471#endif // PACPUS_USE_LOG
    7572
  • branches/2.0-beta1/include/Pacpus/kernel/PacpusApplication.h

    r89 r141  
    1616
    1717#include <QApplication>
     18
     19#include <Pacpus/kernel/pacpus.h>
    1820
    1921namespace pacpus {
Note: See TracChangeset for help on using the changeset viewer.