1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/ct/logger.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,72 @@
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 +
1.25 +/**
1.26 + @file
1.27 + @internalTechnology
1.28 +*/
1.29 +
1.30 +#ifndef __CT_LOGGER_H__
1.31 +#define __CT_LOGGER_H__
1.32 +
1.33 +#include <e32std.h>
1.34 +
1.35 +/**
1.36 + *
1.37 + * Defines logging functionality for use by crypto tokens framework and file
1.38 + * tokens server. This is only compiled in debug builds when the macro
1.39 + * __CT_LOGGING__ is defined.
1.40 + *
1.41 + * @internalTechnology
1.42 + */
1.43 +
1.44 +#if defined(_DEBUG) && defined(__CT_LOGGING__)
1.45 +
1.46 +#define LOG(X) CTLogger::Log(this, (X))
1.47 +#define LOG1(X, Y) CTLogger::Log(this, (X), (Y))
1.48 +#define LOG2(X, Y, Z) CTLogger::Log(this, (X), (Y), (Z))
1.49 +#define LOG_INC_INDENT() CTLogger::UpdateIndent(1)
1.50 +#define LOG_DEC_INDENT() CTLogger::UpdateIndent(-1)
1.51 +
1.52 +#else
1.53 +
1.54 +#define LOG(X)
1.55 +#define LOG1(X, Y)
1.56 +#define LOG2(X, Y, Z)
1.57 +#define LOG_INC_INDENT()
1.58 +#define LOG_DEC_INDENT()
1.59 +
1.60 +#endif
1.61 +
1.62 +/**
1.63 + * Class providing methods used by logging macros. These are not designed to be
1.64 + * called directly. If logging is not turned on they will simply panic.
1.65 + */
1.66 +class CTLogger
1.67 + {
1.68 +public:
1.69 + IMPORT_C static void Log(TAny* aObject, TRefByValue<const TDesC16> aFmt, ...);
1.70 + IMPORT_C static void UpdateIndent(TInt aInc);
1.71 +private:
1.72 + static void LogL(const TDesC& aString);
1.73 + };
1.74 +
1.75 +#endif // __CTLOGGER_H__