os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/shared/msdebug.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/shostmassstorage/server/shared/msdebug.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,83 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// msdebug.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file
1.23 + @internalTechnology
1.24 +*/
1.25 +
1.26 +#ifndef MSDEBUG_H
1.27 +#define MSDEBUG_H
1.28 +
1.29 +// #define _MSFN_DEBUG_PRINT_
1.30 +
1.31 +#if defined(_MSFN_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
1.32 +#define MSFN_TRACE_ENABLED
1.33 +#endif
1.34 +
1.35 +#ifdef MSFN_TRACE_ENABLED
1.36 +#include <e32debug.h>
1.37 +
1.38 +
1.39 +/**
1.40 +Logging function to be used with static functions. Prints the function string on
1.41 +function entry and exit.
1.42 +*/
1.43 +class TMsLogStaticFn
1.44 + {
1.45 +public:
1.46 + static const TInt KLogBufferSize = 0xFF;
1.47 +
1.48 + TMsLogStaticFn(const TDesC8& aFunctionName);
1.49 +
1.50 + ~TMsLogStaticFn();
1.51 +
1.52 +protected:
1.53 + TBuf8<KLogBufferSize> buf;
1.54 + TPtrC8 iFunctionName;
1.55 + };
1.56 +
1.57 +
1.58 +/**
1.59 +Logging function which prints the function string on function entry and exit.
1.60 +*/
1.61 +class TMsLogFn
1.62 + {
1.63 +public:
1.64 + static const TInt KLogBufferSize = 0xFF;
1.65 + TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer);
1.66 +
1.67 + ~TMsLogFn();
1.68 +
1.69 +private:
1.70 + TBuf8<KLogBufferSize> buf;
1.71 + TPtrC8 iFunctionName;
1.72 + void* iThisPointer;
1.73 + };
1.74 +
1.75 +
1.76 +
1.77 +#define __MSFNLOG TMsLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this);
1.78 +#define __MSFNSLOG TMsLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
1.79 +#else
1.80 +#define __MSFNSLOG
1.81 +#define __MSFNLOG
1.82 +#endif
1.83 +
1.84 +#endif // MSDEBUG_H
1.85 +
1.86 +