os/security/cryptomgmtlibs/cryptotokenfw/inc/ct/logger.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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  @file 
    22  @internalTechnology
    23 */
    24  
    25 #ifndef __CT_LOGGER_H__
    26 #define __CT_LOGGER_H__
    27 
    28 #include <e32std.h>
    29 
    30 /**
    31  * 
    32  * Defines logging functionality for use by crypto tokens framework and file
    33  * tokens server.  This is only compiled in debug builds when the macro
    34  * __CT_LOGGING__ is defined.
    35  *
    36  * @internalTechnology
    37  */
    38 
    39 #if defined(_DEBUG) && defined(__CT_LOGGING__)
    40 
    41 #define LOG(X)				CTLogger::Log(this, (X))
    42 #define LOG1(X, Y)			CTLogger::Log(this, (X), (Y))
    43 #define LOG2(X, Y, Z)		CTLogger::Log(this, (X), (Y), (Z))
    44 #define LOG_INC_INDENT()	CTLogger::UpdateIndent(1)
    45 #define LOG_DEC_INDENT()	CTLogger::UpdateIndent(-1)
    46 
    47 #else
    48 
    49 #define LOG(X)
    50 #define LOG1(X, Y)
    51 #define LOG2(X, Y, Z)
    52 #define LOG_INC_INDENT()
    53 #define LOG_DEC_INDENT()
    54 
    55 #endif
    56 
    57 /**
    58  * Class providing methods used by logging macros.  These are not designed to be
    59  * called directly.  If logging is not turned on they will simply panic.
    60  */
    61 class CTLogger
    62 	{
    63 public:
    64 	IMPORT_C static void Log(TAny* aObject, TRefByValue<const TDesC16> aFmt, ...);
    65 	IMPORT_C static void UpdateIndent(TInt aInc);
    66 private:
    67 	static void LogL(const TDesC& aString);
    68 	};
    69 
    70 #endif // __CTLOGGER_H__