sl@0: /*
sl@0: * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: * All rights reserved.
sl@0: * This component and the accompanying materials are made available
sl@0: * under the terms of the License "Eclipse Public License v1.0"
sl@0: * which accompanies this distribution, and is available
sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: *
sl@0: * Initial Contributors:
sl@0: * Nokia Corporation - initial contribution.
sl@0: *
sl@0: * Contributors:
sl@0: *
sl@0: * Description: 
sl@0: * ct/logger.h
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: /**
sl@0:  @file 
sl@0:  @internalTechnology
sl@0: */
sl@0:  
sl@0: #ifndef __CT_LOGGER_H__
sl@0: #define __CT_LOGGER_H__
sl@0: 
sl@0: #include <e32std.h>
sl@0: 
sl@0: /**
sl@0:  * 
sl@0:  * Defines logging functionality for use by crypto tokens framework and file
sl@0:  * tokens server.  This is only compiled in debug builds when the macro
sl@0:  * __CT_LOGGING__ is defined.
sl@0:  *
sl@0:  * @internalTechnology
sl@0:  */
sl@0: 
sl@0: #if defined(_DEBUG) && defined(__CT_LOGGING__)
sl@0: 
sl@0: #define LOG(X)				CTLogger::Log(this, (X))
sl@0: #define LOG1(X, Y)			CTLogger::Log(this, (X), (Y))
sl@0: #define LOG2(X, Y, Z)		CTLogger::Log(this, (X), (Y), (Z))
sl@0: #define LOG_INC_INDENT()	CTLogger::UpdateIndent(1)
sl@0: #define LOG_DEC_INDENT()	CTLogger::UpdateIndent(-1)
sl@0: 
sl@0: #else
sl@0: 
sl@0: #define LOG(X)
sl@0: #define LOG1(X, Y)
sl@0: #define LOG2(X, Y, Z)
sl@0: #define LOG_INC_INDENT()
sl@0: #define LOG_DEC_INDENT()
sl@0: 
sl@0: #endif
sl@0: 
sl@0: /**
sl@0:  * Class providing methods used by logging macros.  These are not designed to be
sl@0:  * called directly.  If logging is not turned on they will simply panic.
sl@0:  */
sl@0: class CTLogger
sl@0: 	{
sl@0: public:
sl@0: 	IMPORT_C static void Log(TAny* aObject, TRefByValue<const TDesC16> aFmt, ...);
sl@0: 	IMPORT_C static void UpdateIndent(TInt aInc);
sl@0: private:
sl@0: 	static void LogL(const TDesC& aString);
sl@0: 	};
sl@0: 
sl@0: #endif // __CTLOGGER_H__