hti/HtiCommPlugins/HtiIPCommPlugin/inc/HtiIPCommLogging.h
branchRCL_3
changeset 59 8ad140f3dd41
parent 0 a03f92240627
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     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:  Logging macros
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HTIIPCOMMLOGGING_H
       
    20 #define HTIIPCOMMLOGGING_H
       
    21 
       
    22 #define LOG_HTI_FLOW
       
    23 
       
    24 #ifdef __ENABLE_LOGGING__
       
    25 
       
    26 #include <flogger.h>
       
    27 
       
    28 _LIT(KLogFolder, "hti");
       
    29 _LIT(KLogFile, "HtiIPComm_log.txt");
       
    30 _LIT(KFreeMemFormat, "Total free: %d bytes");
       
    31 _LIT(KFreeHeapMemFormat, "Heap available: %d bytes, biggest %d bytes");
       
    32 _LIT(KAllocHeapMemFormat, "Heap alloc: %d bytes, %d cells");
       
    33 
       
    34 #define HTI_LOG_TEXT(a1) {_LIT(temp, a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
       
    35 #define HTI_LOG_DES(a1) {RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, (a1));}
       
    36 #define HTI_LOG_FORMAT(a1,a2) {_LIT(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, (a2));}
       
    37 #define HTI_LOG_HEX(p,l) {RFileLogger::HexDump(KLogFolder, KLogFile, EFileLoggingModeAppend, NULL, NULL, p, l);}
       
    38 
       
    39 #define HTI_LOG_FREE_MEM() {TMemoryInfoV1Buf info;UserHal::MemoryInfo(info);RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, KFreeMemFormat, info().iFreeRamInBytes);}
       
    40 #define HTI_LOG_FREE_HEAP_MEM() {TInt b;TInt free=User::Available(b);RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, KFreeHeapMemFormat, free, b);}
       
    41 #define HTI_LOG_ALLOC_HEAP_MEM() {TInt b;TInt c = User::AllocSize(b);RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, KAllocHeapMemFormat, b, c);}
       
    42 
       
    43 //define separately macros to track function flow
       
    44 #ifdef LOG_HTI_FLOW
       
    45 _LIT8(KFuncIn, "-=> %S");
       
    46 _LIT8(KFuncOut, "<=- %S");
       
    47 
       
    48 #define HTI_LOG_FUNC_IN(a1) {_LIT8(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, KFuncIn, &temp);}
       
    49 #define HTI_LOG_FUNC_OUT(a1) {_LIT8(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, KFuncOut, &temp);}
       
    50 
       
    51 #else // LOG_HTI_FLOW
       
    52 
       
    53 #define HTI_LOG_FUNC_IN(a1)
       
    54 #define HTI_LOG_FUNC_OUT(a1)
       
    55 
       
    56 #endif // LOG_HTI_FLOW
       
    57 
       
    58 
       
    59 #else // __ENABLE_LOGGING__
       
    60 
       
    61 #define HTI_LOG_TEXT(a1)
       
    62 #define HTI_LOG_DES(a1)
       
    63 #define HTI_LOG_FORMAT(a1,a2)
       
    64 #define HTI_LOG_HEX(p,l)
       
    65 
       
    66 #define HTI_LOG_FREE_MEM()
       
    67 #define HTI_LOG_FREE_HEAP_MEM()
       
    68 #define HTI_LOG_ALLOC_HEAP_MEM()
       
    69 
       
    70 #define HTI_LOG_FUNC_IN(a1)
       
    71 #define HTI_LOG_FUNC_OUT(a1)
       
    72 
       
    73 #endif // __ENABLE_LOGGING__
       
    74 
       
    75 #endif  //HTIIPCOMMLOGGING_H