cellular/psuinotes/inc/psuilogging.h
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     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 PSUILOGGING_H
       
    19 #define PSUILOGGING_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 #ifdef MSG_OUTPUT_RDEBUG
       
    32 #ifdef Q_OS_SYMBIAN
       
    33 #include <e32debug.h>
       
    34 
       
    35 static void PsUiNotesMsgOutput(QtMsgType type, const char *msg)
       
    36 {
       
    37     switch (type) {
       
    38     
       
    39     case QtDebugMsg:
       
    40         RDebug::Printf("PsUiNotes Debug: %s\n", msg);
       
    41         break;        
       
    42     case QtWarningMsg:
       
    43         RDebug::Printf("PsUiNotes Warning: %s\n", msg);
       
    44         break;
       
    45     case QtCriticalMsg:
       
    46         RDebug::Printf("PsUiNotes Critical: %s\n", msg);
       
    47         break;        
       
    48     case QtFatalMsg:
       
    49         RDebug::Printf("PsUiNotes Fatal: %s\n", msg);
       
    50         abort();
       
    51         break; 
       
    52     default:
       
    53         break; 
       
    54     }
       
    55 }
       
    56 
       
    57     #define INSTALL_TRACE_MSG_HANDLER qInstallMsgHandler(PsUiNotesMsgOutput)
       
    58     #define UNINSTALL_TRACE_MSG_HANDLER qInstallMsgHandler(0)
       
    59 #else //Q_OS_SYMBIAN
       
    60     #define INSTALL_TRACE_MSG_HANDLER
       
    61     #define UNINSTALL_TRACE_MSG_HANDLER
       
    62 #endif
       
    63 #else 
       
    64     #define INSTALL_TRACE_MSG_HANDLER 
       
    65     #define UNINSTALL_TRACE_MSG_HANDLER 
       
    66 #endif //MSG_OUTPUT_RDEBUG
       
    67 
       
    68 /*!
       
    69   Debug macros
       
    70   */
       
    71 #define DPRINT qDebug() << __PRETTY_FUNCTION__
       
    72 #define DWARNING qWarning() << __PRETTY_FUNCTION__
       
    73 
       
    74 #endif // PSUILOGGING_H
       
    75