omadrm/drmengine/roap/inc/RoapLog.h
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2002-2008 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:  Logger utilities for ROAP
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef ROAP_LOG_H
       
    21 #define ROAP_LOG_H
       
    22 
       
    23 #ifdef _DEBUG
       
    24 #include <e32debug.h>
       
    25 #define ROAPDEBUGCODE( a ) a 
       
    26 #define ROAPDEBUG( a ) RDebug::Print( a );
       
    27 #define ROAPDEBUG2( a, b ) RDebug::Print( a, b );
       
    28 #define ROAPDEBUGLIT( a ) ROAPDEBUG( _L ( a ) )
       
    29 #else
       
    30 #define ROAPDEBUGCODE( a )
       
    31 #define ROAPDEBUG( a )
       
    32 #define ROAPDEBUG2( a, b )
       
    33 #define ROAPDEBUGLIT( a )
       
    34 #endif
       
    35 
       
    36 #ifndef _ROAP_TESTING
       
    37 
       
    38 #define LOG( a )
       
    39 #define LOGLIT( a )
       
    40 #define LOGHEX( ptr, len )
       
    41 #define LOG2( a, b )
       
    42 #define PERFORMANCE_LOG( a )
       
    43 #define PERFORMANCE_LOG2( a, b )
       
    44 #define PERFORMANCE_LOGLIT( a )
       
    45 
       
    46 #else // _ROAP_TESTING
       
    47 
       
    48 #include <flogger.h>
       
    49 
       
    50 // #define PERFORMANCE_LOGGING_ONLY // Disables normal logging. Enables only minimal logging for performance testing
       
    51 #define _ROAP_DETAILED_LOGGING // Normal logging + more detailed (signature) logging
       
    52 
       
    53 _LIT(KRoapLogDir, "DRM");
       
    54 _LIT(KRoapLogFile, "ROAP.log");
       
    55 
       
    56 #ifdef PERFORMANCE_LOGGING_ONLY
       
    57 
       
    58 // Performance logging only
       
    59 
       
    60 #define LOG( a )
       
    61 #define LOGLIT( a )
       
    62 #define LOGHEX( ptr, len )
       
    63 #define LOG2( a, b )
       
    64 #define PERFORMANCE_LOG( a ) RFileLogger::Write( KRoapLogDir(), KRoapLogFile(), EFileLoggingModeAppend, a );
       
    65 #define PERFORMANCE_LOG2( a, b ) RFileLogger::WriteFormat( KRoapLogDir(), KRoapLogFile(), EFileLoggingModeAppend, a, b );
       
    66 #define PERFORMANCE_LOGLIT( a ) PERFORMANCE_LOG( _L ( a ) )
       
    67 #else // PERFORMANCE_LOGGING_ONLY
       
    68 
       
    69 // Normal logging
       
    70 
       
    71 #define LOG( a ) RFileLogger::Write( KRoapLogDir(), KRoapLogFile(), EFileLoggingModeAppend, a );
       
    72 #define LOGLIT( a ) LOG( _L ( a ) )
       
    73 #define LOGHEX( ptr, len ) RFileLogger::HexDump( KRoapLogDir(), KRoapLogFile(), EFileLoggingModeAppend, _S(""), _S(""), ptr, len );
       
    74 #define LOG2( a, b ) RFileLogger::WriteFormat( KRoapLogDir(), KRoapLogFile(), EFileLoggingModeAppend, a, b );
       
    75 #define PERFORMANCE_LOG( a )
       
    76 #define PERFORMANCE_LOG2( a, b )
       
    77 #define PERFORMANCE_LOGLIT( a )
       
    78 #endif // PERFORMANCE_LOGGING_ONLY
       
    79 #endif // _ROAP_TESTING
       
    80 #ifdef _ROAP_DETAILED_LOGGING
       
    81 #define DETAILLOG( a ) LOG( a )
       
    82 #define DETAILLOGLIT( a ) LOGLIT( a )
       
    83 #define DETAILLOGHEX( ptr, len ) LOGHEX( ptr, len )
       
    84 #define DETAILLOG2( a, b ) LOG2( a, b )
       
    85 #else
       
    86 #define DETAILLOG( a )
       
    87 #define DETAILLOGLIT( a )
       
    88 #define DETAILLOGHEX( ptr, len )
       
    89 #define DETAILLOG2( a, b )
       
    90 #endif
       
    91 
       
    92 #endif // ROAP_LOG_H