systemswstubs/exampledsy/inc/dsydebug.h
changeset 0 0ce1b5ce9557
equal deleted inserted replaced
-1:000000000000 0:0ce1b5ce9557
       
     1 /*
       
     2 * Copyright (c) 2002 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:  This file defines logging macros for DSY plugin.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DSYDEBUG_H
       
    20 #define DSYDEBUG_H
       
    21 
       
    22 #include <f32file.h>
       
    23 
       
    24 
       
    25 #ifdef _DEBUG
       
    26 
       
    27 // Enable this to enable memory tracing
       
    28 // for BT Phone Host Interface
       
    29 //#define MEMTRACE
       
    30 
       
    31 #ifdef __WINS__
       
    32 #define __FLOGGING__ // File logging for WINS
       
    33 #else
       
    34 #define __CLOGGING__ // Logging with RDebug for target HW
       
    35 #endif //__WINS__
       
    36 
       
    37 #endif // _DEBUG
       
    38 
       
    39 
       
    40 // File logging
       
    41 //
       
    42 #if  defined(__FLOGGING__)
       
    43 
       
    44 #include <e32std.h>
       
    45 
       
    46 _LIT(KLogFile,"doslog.txt");
       
    47 _LIT(KLogDirFullName,"c:\\logs\\bt\\");
       
    48 _LIT(KLogDir,"BT");
       
    49 
       
    50 #include <f32file.h>
       
    51 #include <flogger.h>
       
    52 
       
    53 #define FLOG(a) { FPrint(a); } 
       
    54 #define FTRACE(a) { a; }
       
    55 
       
    56 // Declare the FPrint function
       
    57 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
       
    58     {
       
    59     VA_LIST list;
       
    60     VA_START(list,aFmt);
       
    61     RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
       
    62 
       
    63 #ifdef MEMTRACE // If memory tracing is activated.
       
    64 	TInt size;
       
    65 	User::Heap().AllocSize(size);	
       
    66 	RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, _L("[TBTPHI]\t MEM\tMemory usage: %d high: %d"), size, User::Heap().Size());
       
    67 #endif
       
    68     }
       
    69 
       
    70 
       
    71 // RDebug logging
       
    72 //
       
    73 #elif defined(__CLOGGING__)
       
    74 
       
    75 #include <e32svr.h>
       
    76 
       
    77 #define FLOG(a) { RDebug::Print(a);  }
       
    78 #define FLOGHEX(a)
       
    79 #define FTRACE(a) { a; }
       
    80 
       
    81 // Declare the FPrint function
       
    82 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
       
    83     {
       
    84     VA_LIST list;
       
    85     VA_START(list,aFmt);
       
    86     TInt tmpInt = VA_ARG(list, TInt);
       
    87     TInt tmpInt2 = VA_ARG(list, TInt);
       
    88     TInt tmpInt3 = VA_ARG(list, TInt);
       
    89     VA_END(list);
       
    90     RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3);
       
    91     }
       
    92 
       
    93 
       
    94 // No loggings --> Reduced binary size
       
    95 //
       
    96 #else   
       
    97 #define FLOG(a)
       
    98 #define FLOGHEX(a)
       
    99 #define FTRACE(a)
       
   100 #endif
       
   101 
       
   102 #endif // DSYDEBUG_H
       
   103 
       
   104 // End of File