phoneplugins/infowidgetplugin/infowidgetprovider/inc/infowidgetlogging.h
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 40 bab96b7ed1a4
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef INFOWIDGETLOGGING_H
       
    19 #define INFOWIDGETLOGGING_H
       
    20 
       
    21 #include <QDebug>
       
    22 
       
    23 
       
    24 /*!
       
    25   Define MSG_OUTPUT_RDEBUG 
       
    26   for enabling RDebug prints in development tracing. 
       
    27   Shouldn't be used in release code.
       
    28   */
       
    29 #undef MSG_OUTPUT_RDEBUG
       
    30 
       
    31 
       
    32 #ifdef MSG_OUTPUT_RDEBUG
       
    33 #ifdef Q_OS_SYMBIAN
       
    34 #include <e32debug.h>
       
    35 
       
    36 static void infoWidgetMsgOutput(QtMsgType type, const char *msg)
       
    37 {
       
    38     switch (type) {
       
    39         
       
    40     case QtDebugMsg:
       
    41         RDebug::Printf("InfoWidget Debug: %s\n", msg);
       
    42         break;
       
    43     case QtWarningMsg:
       
    44         RDebug::Printf("InfoWidget Warning: %s\n", msg);
       
    45         break;
       
    46     case QtCriticalMsg:
       
    47         RDebug::Printf("InfoWidget Critical: %s\n", msg);
       
    48         break;
       
    49     case QtFatalMsg:
       
    50         RDebug::Printf("InfoWidget Fatal: %s\n", msg);
       
    51         abort();
       
    52     }
       
    53 }
       
    54 
       
    55     #define INSTALL_TRACE_MSG_HANDLER qInstallMsgHandler(infoWidgetMsgOutput)
       
    56     #define UNINSTALL_TRACE_MSG_HANDLER qInstallMsgHandler(0)
       
    57 #endif //Q_OS_SYMBIAN
       
    58 #else 
       
    59     #define INSTALL_TRACE_MSG_HANDLER 
       
    60     #define UNINSTALL_TRACE_MSG_HANDLER 
       
    61 #endif //MSG_OUTPUT_RDEBUG
       
    62 
       
    63 /*!
       
    64   Debug macros
       
    65   */
       
    66 #define DPRINT qDebug() << __PRETTY_FUNCTION__
       
    67 #define DWARNING qWarning() << __PRETTY_FUNCTION__
       
    68 #define DCRITICAL qCritical() << __PRETTY_FUNCTION__
       
    69 
       
    70 #endif // INFOWIDGETLOGGING
       
    71