utilities/log/ariprint.h
changeset 0 bb31fbe78861
equal deleted inserted replaced
-1:000000000000 0:bb31fbe78861
       
     1 /*
       
     2 * Copyright (c) 2009 Aricent and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Aricent - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * This is a header file, which is required for
       
    16 * enabling / disabling debug prints
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef ARIPRINT_H__
       
    22 #define ARIPRINT_H__
       
    23 
       
    24 #include <e32debug.h>
       
    25 
       
    26 
       
    27 #define LEVEL_LOW		2
       
    28 #define LEVEL_HIGH		1
       
    29 #define LEVEL_CRITICAL	0
       
    30 #define LEVEL_NONE		-1
       
    31 
       
    32 #ifdef LOGLEVEL_LOW
       
    33 #undef LOGLEVEL_HIGH
       
    34 #undef LOGLEVEL_CRITICAL
       
    35 #undef LOGLEVEL_NONE
       
    36 #define PRINT(x, y)			{if(x <= LEVEL_LOW) RDebug::Printf y;}
       
    37 #endif
       
    38 
       
    39 #ifdef LOGLEVEL_HIGH
       
    40 #undef LOGLEVEL_LOW
       
    41 #undef LOGLEVEL_CRITICAL
       
    42 #undef LOGLEVEL_NONE
       
    43 #define PRINT(x, y)			{if(x <= LEVEL_HIGH) RDebug::Printf y;}
       
    44 #endif
       
    45 
       
    46 #ifdef LOGLEVEL_CRITICAL
       
    47 #undef LOGLEVEL_HIGH
       
    48 #undef LOGLEVEL_LOW
       
    49 #undef LOGLEVEL_NONE
       
    50 #define PRINT(x, y)			{if(x <= LEVEL_CRITICAL) RDebug::Printf y;}
       
    51 #endif
       
    52 
       
    53 #ifdef LOGLEVEL_NONE
       
    54 #undef LOGLEVEL_HIGH
       
    55 #undef LOGLEVEL_CRITICAL
       
    56 #undef LOGLEVEL_LOW
       
    57 #define PRINT(x, y)			{;}
       
    58 #endif
       
    59 
       
    60 
       
    61 #define PRINT_ENTRY			PRINT(LEVEL_LOW, ("--> %s", __PRETTY_FUNCTION__))
       
    62 #define PRINT_EXIT			PRINT(LEVEL_LOW, ("<-- %s", __PRETTY_FUNCTION__))
       
    63 #define PRINT_ERR(y)		PRINT(LEVEL_CRITICAL, ("ERROR: %s, Ln: %d, %s", __PRETTY_FUNCTION__, __LINE__, y))
       
    64 #define PRINT_MSG(x, y)		PRINT(x, y)
       
    65 
       
    66 
       
    67 #endif	// ARIPRINT_H__