epoc32/include/ct/logger.h
branchSymbian2
changeset 2 2fe1408b6811
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
       
     1 /*
       
     2 * Copyright (c) 2001-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 the License "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 * ct/logger.h
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file 
       
    24  @internalTechnology
       
    25 */
       
    26  
       
    27 #ifndef __CT_LOGGER_H__
       
    28 #define __CT_LOGGER_H__
       
    29 
       
    30 #include <e32std.h>
       
    31 
       
    32 /**
       
    33  * 
       
    34  * Defines logging functionality for use by crypto tokens framework and file
       
    35  * tokens server.  This is only compiled in debug builds when the macro
       
    36  * __CT_LOGGING__ is defined.
       
    37  *
       
    38  * @internalTechnology
       
    39  */
       
    40 
       
    41 #if defined(_DEBUG) && defined(__CT_LOGGING__)
       
    42 
       
    43 #define LOG(X)				CTLogger::Log(this, (X))
       
    44 #define LOG1(X, Y)			CTLogger::Log(this, (X), (Y))
       
    45 #define LOG2(X, Y, Z)		CTLogger::Log(this, (X), (Y), (Z))
       
    46 #define LOG_INC_INDENT()	CTLogger::UpdateIndent(1)
       
    47 #define LOG_DEC_INDENT()	CTLogger::UpdateIndent(-1)
       
    48 
       
    49 #else
       
    50 
       
    51 #define LOG(X)
       
    52 #define LOG1(X, Y)
       
    53 #define LOG2(X, Y, Z)
       
    54 #define LOG_INC_INDENT()
       
    55 #define LOG_DEC_INDENT()
       
    56 
       
    57 #endif
       
    58 
       
    59 /**
       
    60  * Class providing methods used by logging macros.  These are not designed to be
       
    61  * called directly.  If logging is not turned on they will simply panic.
       
    62  */
       
    63 class CTLogger
       
    64 	{
       
    65 public:
       
    66 	IMPORT_C static void Log(TAny* aObject, TRefByValue<const TDesC16> aFmt, ...);
       
    67 	IMPORT_C static void UpdateIndent(TInt aInc);
       
    68 private:
       
    69 	static void LogL(const TDesC& aString);
       
    70 	};
       
    71 
       
    72 #endif // __CTLOGGER_H__