os/security/cryptomgmtlibs/cryptotokenfw/inc/ct/logger.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptomgmtlibs/cryptotokenfw/inc/ct/logger.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,70 @@
     1.4 +/*
     1.5 +* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* ct/logger.h
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +/**
    1.24 + @file 
    1.25 + @internalTechnology
    1.26 +*/
    1.27 + 
    1.28 +#ifndef __CT_LOGGER_H__
    1.29 +#define __CT_LOGGER_H__
    1.30 +
    1.31 +#include <e32std.h>
    1.32 +
    1.33 +/**
    1.34 + * 
    1.35 + * Defines logging functionality for use by crypto tokens framework and file
    1.36 + * tokens server.  This is only compiled in debug builds when the macro
    1.37 + * __CT_LOGGING__ is defined.
    1.38 + *
    1.39 + * @internalTechnology
    1.40 + */
    1.41 +
    1.42 +#if defined(_DEBUG) && defined(__CT_LOGGING__)
    1.43 +
    1.44 +#define LOG(X)				CTLogger::Log(this, (X))
    1.45 +#define LOG1(X, Y)			CTLogger::Log(this, (X), (Y))
    1.46 +#define LOG2(X, Y, Z)		CTLogger::Log(this, (X), (Y), (Z))
    1.47 +#define LOG_INC_INDENT()	CTLogger::UpdateIndent(1)
    1.48 +#define LOG_DEC_INDENT()	CTLogger::UpdateIndent(-1)
    1.49 +
    1.50 +#else
    1.51 +
    1.52 +#define LOG(X)
    1.53 +#define LOG1(X, Y)
    1.54 +#define LOG2(X, Y, Z)
    1.55 +#define LOG_INC_INDENT()
    1.56 +#define LOG_DEC_INDENT()
    1.57 +
    1.58 +#endif
    1.59 +
    1.60 +/**
    1.61 + * Class providing methods used by logging macros.  These are not designed to be
    1.62 + * called directly.  If logging is not turned on they will simply panic.
    1.63 + */
    1.64 +class CTLogger
    1.65 +	{
    1.66 +public:
    1.67 +	IMPORT_C static void Log(TAny* aObject, TRefByValue<const TDesC16> aFmt, ...);
    1.68 +	IMPORT_C static void UpdateIndent(TInt aInc);
    1.69 +private:
    1.70 +	static void LogL(const TDesC& aString);
    1.71 +	};
    1.72 +
    1.73 +#endif // __CTLOGGER_H__