apengine/apeng/inc/ApEngineLogger.h
changeset 61 8b0c979bbe8c
parent 59 2709c04a4af5
child 70 ac5daea24fb0
equal deleted inserted replaced
59:2709c04a4af5 61:8b0c979bbe8c
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *      Logging macros for Access Point Engine
       
    16 *      
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef APENGINE_LOGGER_H
       
    22 #define APENGINE_LOGGER_H
       
    23 
       
    24 // INCLUDES
       
    25 
       
    26 #ifdef __TEST_APENGINE_LOG__
       
    27     #include <e32std.h>
       
    28     #include <e32def.h>
       
    29     #include <flogger.h>
       
    30 
       
    31     // TYPES
       
    32 
       
    33     enum TApEngineLogMask             ///< Log mask bits.
       
    34         {
       
    35         ELogOff         = 0x00000000,   ///< Don't log.
       
    36         ETransaction    = 0x00000001,   ///< Log transaction activity.
       
    37         ESelect         = 0x00000002,   ///< Log ApSelect activity.
       
    38         EHandler        = 0x00000004,   ///< Log ApDataHandler activity.
       
    39         EUtil           = 0x00000008,   ///< Log ApUtils activity.
       
    40         ENetworks       = 0x0000000F,   ///< Log Networks activity.
       
    41         EApList         = 0x00000010,   ///< Log ApList activity.
       
    42         EProtection     = 0x00000020,   ///< Log protection activity.
       
    43         EApItem         = 0x00000040,   ///< Log ApItem activity.
       
    44         ECommons        = 0x00000080,   ///< Log transaction activity.
       
    45         EActiveDb       = 0x000000F0,   ///< Log active db & notification 
       
    46                                         ///< activity.
       
    47 
       
    48         ESpecial        = 0x0FFFF000,   ///< Log special, temp stuff only
       
    49         ELogAll         = 0xFFFFFFFF    ///< Log all.
       
    50         };
       
    51 
       
    52     // MACROS
       
    53 
       
    54     /// Determines what to log. Construct this from TApEngineLogMask values.
       
    55     #define APENGINE_LOG_MASK ELogAll
       
    56 
       
    57     /// Determines log detail (0==basic level).
       
    58     #define APENGINE_LOG_LEVEL 4
       
    59 
       
    60     // CLASS DECLARATION
       
    61 
       
    62     /**
       
    63     * Logger class.
       
    64     */
       
    65     NONSHARABLE_CLASS( ApEngineLogger )
       
    66         {
       
    67         public:     // new methods
       
    68 
       
    69         /**
       
    70         * Write formatted log.
       
    71         * @param aMask Log mask.
       
    72         * @param aLevel Log level.
       
    73         * @param aFmt Format string.
       
    74         */
       
    75         static void Write
       
    76             ( TInt32 aMask, TInt aLevel, 
       
    77               TRefByValue<const TDesC16> aFmt, ... );
       
    78 
       
    79         /**
       
    80         * Write formatted log.
       
    81         * @param aMask Log mask.
       
    82         * @param aLevel Log level.
       
    83         * @param aFmt Format string.
       
    84         * @param aList Variable argument list.
       
    85         */
       
    86         static void Write
       
    87             (
       
    88             TInt32 aMask,
       
    89             TInt aLevel,
       
    90             TRefByValue<const TDesC16> aFmt,
       
    91             VA_LIST& aList
       
    92             );
       
    93 
       
    94         /**
       
    95         * Write formatted log.
       
    96         * @param aMask Log mask.
       
    97         * @param aLevel Log level.
       
    98         * @param aFmt Format string.
       
    99         */
       
   100         static void Write
       
   101             ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC8> aFmt, ... );
       
   102 
       
   103         /**
       
   104         * Write formatted log.
       
   105         * @param aMask Log mask.
       
   106         * @param aLevel Log level.
       
   107         * @param aFmt Format string.
       
   108         * @param aList Variable argument list.
       
   109         */
       
   110         static void Write
       
   111             (
       
   112             TInt32 aMask,
       
   113             TInt aLevel,
       
   114             TRefByValue<const TDesC8> aFmt,
       
   115             VA_LIST& aList
       
   116             );
       
   117 
       
   118         /**
       
   119         * Write hex dump.
       
   120         * @param aMask Log mask.
       
   121         * @param aLevel Log level.
       
   122         * @param aHeader Header string.
       
   123         * @param aMargin Margin.
       
   124         * @param aPtr Data.
       
   125         * @param aLen Data length.
       
   126         */
       
   127         static void HexDump
       
   128             (
       
   129             TInt32 aMask,
       
   130             TInt aLevel, 
       
   131             const TText* aHeader,
       
   132             const TText* aMargin,
       
   133             const TUint8* aPtr,
       
   134             TInt aLen
       
   135             );
       
   136         };
       
   137 
       
   138 
       
   139     /// Write formatted to log.
       
   140     #define CLOG( body ) ApEngineLogger::Write body
       
   141     /// Write hex dump.
       
   142     #define CDUMP( body ) ApEngineLogger::HexDump body
       
   143 
       
   144 #else /* not defined __TEST_APENGINE_LOG__ */
       
   145 
       
   146     /// Do nothing (log disabled).
       
   147     #define CLOG( body )
       
   148     /// Do nothing (log disabled).
       
   149     #define CDUMP( body )
       
   150 
       
   151 #endif /* def __TEST_APENGINE_LOG__ */
       
   152 
       
   153 #endif /* def APENGINE_LOGGER_H */