logging_qt_qxdebug.hpp

Go to the documentation of this file.
00001 #ifndef __logging_qt_qxdebug_hpp__
00002 #define __logging_qt_qxdebug_hpp__
00003 
00004 #include "common/logging_c.h" // logt
00005 
00006 #include <QDebug>
00007 #include <QString>
00008 
00009 class QxDebug
00010 {
00011   private:
00012   QString s;
00013   QDebug d;
00014 
00015   public:
00016   QxDebug() : d(QDebug(&s)) {}
00017 
00018   ~QxDebug() {
00019     if (!s.isEmpty()) {
00020       logt(s.toUtf8().data());
00021     }
00022   }
00023 
00024   QDebug& Debug() { return d; }
00025 };
00026 
00027 #endif /* __logging_qt_qxdebug_hpp__ */
00028 
00029 /**
00030 
00031 Copyright 2010 Helsinki Institute for Information Technology (HIIT)
00032 and the authors. All rights reserved.
00033 
00034 Authors: Tero Hasu <tero.hasu@hut.fi>
00035 
00036 Permission is hereby granted, free of charge, to any person
00037 obtaining a copy of this software and associated documentation files
00038 (the "Software"), to deal in the Software without restriction,
00039 including without limitation the rights to use, copy, modify, merge,
00040 publish, distribute, sublicense, and/or sell copies of the Software,
00041 and to permit persons to whom the Software is furnished to do so,
00042 subject to the following conditions:
00043 
00044 The above copyright notice and this permission notice shall be
00045 included in all copies or substantial portions of the Software.
00046 
00047 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00048 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00049 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00050 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00051 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00052 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00053 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00054 SOFTWARE.
00055 
00056  **/

ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:54 2011 by Doxygen 1.6.1