phonesettings/cpphonesettingsplugins/cptelephonyutils/inc/cppluginlogging.h
branchRCL_3
changeset 61 41a7f70b3818
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
       
     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 CPPHONESETTINGSPLUGINSLOGGING_H
       
    19 #define CPPHONESETTINGSPLUGINSLOGGING_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 
       
    33 #ifdef MSG_OUTPUT_RDEBUG
       
    34 #ifdef Q_OS_SYMBIAN
       
    35 #include <e32debug.h>
       
    36 
       
    37 static void cpPhoneSettingsPluginsMsgOutput(QtMsgType type, const char *msg)
       
    38 {
       
    39     switch (type) {
       
    40     
       
    41     case QtDebugMsg:
       
    42         RDebug::Printf("CpPhoneSettingsPlugins Debug: %s\n", msg);
       
    43         break;        
       
    44     case QtWarningMsg:
       
    45         RDebug::Printf("CpPhoneSettingsPlugins Warning: %s\n", msg);
       
    46         break;
       
    47     case QtCriticalMsg:
       
    48         RDebug::Printf("CpPhoneSettingsPlugins Critical: %s\n", msg);
       
    49         break;        
       
    50     case QtFatalMsg:
       
    51         RDebug::Printf("CpPhoneSettingsPlugins Fatal: %s\n", msg);
       
    52         abort();
       
    53         break; 
       
    54     default:
       
    55         break; 
       
    56     }
       
    57 }
       
    58 
       
    59     #define INSTALL_TRACE_MSG_HANDLER qInstallMsgHandler(cpPhoneSettingsPluginsMsgOutput)
       
    60     #define UNINSTALL_TRACE_MSG_HANDLER qInstallMsgHandler(0)
       
    61 #else //Q_OS_SYMBIAN
       
    62     #define INSTALL_TRACE_MSG_HANDLER
       
    63     #define UNINSTALL_TRACE_MSG_HANDLER
       
    64 #endif
       
    65 #else 
       
    66     #define INSTALL_TRACE_MSG_HANDLER 
       
    67     #define UNINSTALL_TRACE_MSG_HANDLER 
       
    68 #endif //MSG_OUTPUT_RDEBUG
       
    69 
       
    70 /*!
       
    71   Debug macros
       
    72   */
       
    73 #define DPRINT qDebug() << __PRETTY_FUNCTION__
       
    74 #define DWARNING qWarning() << __PRETTY_FUNCTION__
       
    75 #define DCRITICAL qCritical() << __PRETTY_FUNCTION__
       
    76 
       
    77 #endif // CPPHONESETTINGSPLUGINSLOGGING_H
       
    78