messagingappbase/ncnlist/inc/NcnDebug.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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:  NcnDebug  declaration
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef NCNDEBUG_H
       
    19 #define NCNDEBUG_H
       
    20 
       
    21 #include    "NcnVariant.hrh"
       
    22 
       
    23 #include    <e32svr.h>
       
    24 #include    <flogger.h>
       
    25 #include    <f32file.h>
       
    26 
       
    27 // DEFINES
       
    28 #ifdef _DEBUG   // debug build environment
       
    29 
       
    30 #ifdef _NCN_FLOG
       
    31 
       
    32 // The log path
       
    33 _LIT( KLogPath, "c:\\logs\\NcnList\\" );
       
    34 
       
    35 // The name of the log folder
       
    36 _LIT(KLogDir,"NcnList");
       
    37 
       
    38 //The log file
       
    39 _LIT(KLogFile,"NcnListLog.txt");
       
    40 
       
    41 // Declare the FPrint function
       
    42 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
       
    43     {
       
    44     VA_LIST list;
       
    45     VA_START(list,aFmt);
       
    46     
       
    47 	// Make the log directory
       
    48 	RFs fs;
       
    49 	if (fs.Connect() == KErrNone)
       
    50 		{
       
    51 		fs.MkDirAll( KLogPath );
       
    52 		fs.Close();
       
    53 		}
       
    54 		
       
    55     RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
       
    56     }
       
    57 
       
    58     #define NCN_RDEBUG(X)                   { FPrint(X); }
       
    59     #define NCN_RDEBUG_INT(X,Y)             { FPrint(X,Y); }
       
    60     #define NCN_RDEBUG_INT2(X,Y,Z)          { FPrint(X,Y,Z); }
       
    61 
       
    62 #else   // _NCN_FLOG
       
    63 
       
    64     #define NCN_RDEBUG(X)                   RDebug::Print(X)
       
    65     #define NCN_RDEBUG_INT(X,Y)             RDebug::Print(X,Y)
       
    66     #define NCN_RDEBUG_INT2(X,Y,Z)          RDebug::Print(X,Y,Z)
       
    67 
       
    68 #endif  // _NCN_FLOG
       
    69 
       
    70 #else   // _DEBUG hw environment
       
    71     #define NCN_RDEBUG(X)
       
    72     #define NCN_RDEBUG_INT(X,Y)
       
    73     #define NCN_RDEBUG_INT2(X,Y,Z)
       
    74 #endif  // _DEBUG
       
    75 
       
    76 #endif  // NCNDEBUG_H