os/kernelhwsrv/kerneltest/f32test/shostmassstorage/msman/shared/tmslog.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:
sl@0
    15
* @file tmslog.h
sl@0
    16
* 
sl@0
    17
*
sl@0
    18
*/
sl@0
    19
sl@0
    20
sl@0
    21
sl@0
    22
sl@0
    23
sl@0
    24
sl@0
    25
#ifndef TMSLOG_H
sl@0
    26
#define TMSLOG_H
sl@0
    27
sl@0
    28
//#define _TESTAPP_DEBUG_PRINT_
sl@0
    29
sl@0
    30
#if (defined(_DEBUG) || defined(_DEBUG_RELEASE))
sl@0
    31
#include <e32debug.h>
sl@0
    32
#endif
sl@0
    33
sl@0
    34
#if defined(_TESTAPP_DEBUG_PRINT_) && (defined(_DEBUG) || defined(_DEBUG_RELEASE))
sl@0
    35
#define TRACE_ENABLED
sl@0
    36
#endif
sl@0
    37
sl@0
    38
#ifdef TRACE_ENABLED
sl@0
    39
sl@0
    40
class TMsLogStaticFn
sl@0
    41
    {
sl@0
    42
public:
sl@0
    43
    static const TInt KLogBufferSize = 0xFF;
sl@0
    44
sl@0
    45
    TMsLogStaticFn(const TDesC8& aFunctionName);
sl@0
    46
sl@0
    47
	~TMsLogStaticFn();
sl@0
    48
sl@0
    49
protected:
sl@0
    50
    TBuf8<KLogBufferSize> buf;
sl@0
    51
	TPtrC8 iFunctionName;
sl@0
    52
    };
sl@0
    53
sl@0
    54
sl@0
    55
sl@0
    56
sl@0
    57
class TMsLogFn
sl@0
    58
    {
sl@0
    59
public:
sl@0
    60
    static const TInt KLogBufferSize = 0xFF;
sl@0
    61
	TMsLogFn(const TDesC8& aFunctionName, void* aThisPointer);
sl@0
    62
sl@0
    63
	~TMsLogFn();
sl@0
    64
sl@0
    65
private:
sl@0
    66
    TBuf8<KLogBufferSize> buf;
sl@0
    67
	TPtrC8 iFunctionName;
sl@0
    68
	void* iThisPointer;
sl@0
    69
    };
sl@0
    70
sl@0
    71
sl@0
    72
sl@0
    73
sl@0
    74
#define __MSFNLOG TMsLogFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__), this);
sl@0
    75
#define __MSFNSLOG TMsLogStaticFn funcLog(TPtrC8((TUint8*)__PRETTY_FUNCTION__));
sl@0
    76
#else
sl@0
    77
#define __MSFNSLOG
sl@0
    78
#define __MSFNLOG
sl@0
    79
#endif
sl@0
    80
sl@0
    81
sl@0
    82
sl@0
    83
#ifdef TRACE_ENABLED
sl@0
    84
#define __PRINT(t) {RDebug::Print(t);}
sl@0
    85
#define __PRINT1(t,a) {RDebug::Print(t,a);}
sl@0
    86
#define __PRINT2(t,a,b) {RDebug::Print(t,a,b);}
sl@0
    87
#define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
sl@0
    88
#else
sl@0
    89
#define __PRINT(t)
sl@0
    90
#define __PRINT1(t,a)
sl@0
    91
#define __PRINT2(t,a,b)
sl@0
    92
#define __PRINT3(t,a,b,c)
sl@0
    93
sl@0
    94
#endif
sl@0
    95
sl@0
    96
sl@0
    97
#endif // TMSLOG_H