apengine/apeng/src/ApEngineLogger.cpp
changeset 0 5a93021fdf25
child 66 ed07dcc72692
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     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 *      Implementation of class ApEngineLogger.   
       
    16 *      
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #ifdef __TEST_APENGINE_LOG__
       
    24 
       
    25     #include "ApEngineLogger.h"
       
    26     #include <flogger.h>
       
    27 
       
    28     // ================= CONSTANTS =======================
       
    29 
       
    30     /// ApEngine logging directory.
       
    31     _LIT( KApEngineLogDir, "ApEngine" );
       
    32     /// ApEngine log file name.
       
    33     _LIT( KApEngineLogFile, "ApEngine.txt" );
       
    34 
       
    35 
       
    36     // ================= MEMBER FUNCTIONS =======================
       
    37 
       
    38     // ---------------------------------------------------------
       
    39     // ApEngineLogger::Write()
       
    40     // ---------------------------------------------------------
       
    41     //
       
    42     void ApEngineLogger::Write
       
    43     ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC16> aFmt, ... )
       
    44         {
       
    45         if( (aMask & APENGINE_LOG_MASK) && (aLevel <= APENGINE_LOG_LEVEL) )
       
    46             {
       
    47             VA_LIST list;
       
    48             VA_START( list, aFmt );
       
    49             RFileLogger::WriteFormat
       
    50                 (
       
    51                 KApEngineLogDir,
       
    52                 KApEngineLogFile,
       
    53                 EFileLoggingModeAppend,
       
    54                 aFmt,
       
    55                 list
       
    56                 );
       
    57             VA_END( list );
       
    58             }
       
    59         }
       
    60 
       
    61 
       
    62     // ---------------------------------------------------------
       
    63     // ApEngineLogger::Write()
       
    64     // ---------------------------------------------------------
       
    65     //
       
    66     void ApEngineLogger::Write
       
    67     ( TInt32 aMask, TInt aLevel, 
       
    68       TRefByValue<const TDesC16> aFmt, 
       
    69       VA_LIST& aList )
       
    70         {
       
    71         if( (aMask & APENGINE_LOG_MASK) && (aLevel <= APENGINE_LOG_LEVEL) )
       
    72             {
       
    73             RFileLogger::WriteFormat
       
    74                 (
       
    75                 KApEngineLogDir,
       
    76                 KApEngineLogFile,
       
    77                 EFileLoggingModeAppend,
       
    78                 aFmt,
       
    79                 aList
       
    80                 );
       
    81             }
       
    82         }
       
    83 
       
    84 
       
    85     // ---------------------------------------------------------
       
    86     // ApEngineLogger::Write()
       
    87     // ---------------------------------------------------------
       
    88     //
       
    89     void ApEngineLogger::Write
       
    90     ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC8> aFmt, ... )
       
    91         {
       
    92         if( (aMask & APENGINE_LOG_MASK) && (aLevel <= APENGINE_LOG_LEVEL) )
       
    93             {
       
    94             VA_LIST list;
       
    95             VA_START( list, aFmt );
       
    96             RFileLogger::WriteFormat
       
    97                 (
       
    98                 KApEngineLogDir,
       
    99                 KApEngineLogFile,
       
   100                 EFileLoggingModeAppend,
       
   101                 aFmt,
       
   102                 list
       
   103                 );
       
   104             VA_END( list );
       
   105             }
       
   106         }
       
   107 
       
   108 
       
   109     // ---------------------------------------------------------
       
   110     // ApEngineLogger::Write()
       
   111     // ---------------------------------------------------------
       
   112     //
       
   113     void ApEngineLogger::Write
       
   114     ( TInt32 aMask, TInt aLevel, 
       
   115       TRefByValue<const TDesC8> aFmt, VA_LIST& aList )
       
   116         {
       
   117         if( (aMask & APENGINE_LOG_MASK) && (aLevel <= APENGINE_LOG_LEVEL) )
       
   118             {
       
   119             RFileLogger::WriteFormat
       
   120                 (
       
   121                 KApEngineLogDir,
       
   122                 KApEngineLogFile,
       
   123                 EFileLoggingModeAppend,
       
   124                 aFmt,
       
   125                 aList
       
   126                 );
       
   127             }
       
   128         }
       
   129 
       
   130 
       
   131     // ---------------------------------------------------------
       
   132     // ApEngineLogger::HexDump()
       
   133     // ---------------------------------------------------------
       
   134     //
       
   135     void ApEngineLogger::HexDump
       
   136             (
       
   137             TInt32 aMask,
       
   138             TInt aLevel, 
       
   139             const TText* aHeader,
       
   140             const TText* aMargin,
       
   141             const TUint8* aPtr,
       
   142             TInt aLen
       
   143             )
       
   144         {
       
   145         if( (aMask & APENGINE_LOG_MASK) && (aLevel <= APENGINE_LOG_LEVEL) )
       
   146             {
       
   147             RFileLogger::HexDump
       
   148                 (
       
   149                 KApEngineLogDir,
       
   150                 KApEngineLogFile,
       
   151                 EFileLoggingModeAppend,
       
   152                 aHeader,
       
   153                 aMargin,
       
   154                 aPtr,
       
   155                 aLen
       
   156                 );
       
   157             }
       
   158         }
       
   159 #endif // __TEST_APENGINE_LOG__