codhandler/codeng/src/CodLogger.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *      Implementation of class CodLogger.   
       
    16 *      
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include "CodLogger.h"
       
    24 #include <flogger.h>
       
    25 
       
    26 #ifdef __TEST_COD_LOG
       
    27 
       
    28 // ================= CONSTANTS =======================
       
    29 
       
    30 /// COD logging directory.
       
    31 _LIT( KCodLogDir, "Cod" );
       
    32 /// COD log file name.
       
    33 _LIT( KCodLogFile, "CodEng.txt" );
       
    34 
       
    35 // ================= MEMBER FUNCTIONS =======================
       
    36 
       
    37 // ---------------------------------------------------------
       
    38 // CodLogger::Write()
       
    39 // ---------------------------------------------------------
       
    40 //
       
    41 void CodLogger::Write
       
    42 ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC16> aFmt, ... )
       
    43     {
       
    44     if( (aMask & COD_LOG_MASK) && (aLevel <= COD_LOG_LEVEL) )
       
    45         {
       
    46         VA_LIST list;
       
    47         VA_START( list, aFmt );
       
    48         RFileLogger::WriteFormat
       
    49             (
       
    50             KCodLogDir,
       
    51             KCodLogFile,
       
    52             EFileLoggingModeAppend,
       
    53             aFmt,
       
    54             list
       
    55             );
       
    56         VA_END( list );
       
    57         }
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------
       
    61 // CodLogger::Write()
       
    62 // ---------------------------------------------------------
       
    63 //
       
    64 void CodLogger::Write
       
    65 ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC16> aFmt, VA_LIST& aList )
       
    66     {
       
    67     if( (aMask & COD_LOG_MASK) && (aLevel <= COD_LOG_LEVEL) )
       
    68         {
       
    69         RFileLogger::WriteFormat
       
    70             (
       
    71             KCodLogDir,
       
    72             KCodLogFile,
       
    73             EFileLoggingModeAppend,
       
    74             aFmt,
       
    75             aList
       
    76             );
       
    77         }
       
    78     }
       
    79 
       
    80 // ---------------------------------------------------------
       
    81 // CodLogger::Write()
       
    82 // ---------------------------------------------------------
       
    83 //
       
    84 void CodLogger::Write
       
    85 ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC8> aFmt, ... )
       
    86     {
       
    87     if( (aMask & COD_LOG_MASK) && (aLevel <= COD_LOG_LEVEL) )
       
    88         {
       
    89         VA_LIST list;
       
    90         VA_START( list, aFmt );
       
    91         RFileLogger::WriteFormat
       
    92             (
       
    93             KCodLogDir,
       
    94             KCodLogFile,
       
    95             EFileLoggingModeAppend,
       
    96             aFmt,
       
    97             list
       
    98             );
       
    99         VA_END( list );
       
   100         }
       
   101     }
       
   102 
       
   103 // ---------------------------------------------------------
       
   104 // CodLogger::Write()
       
   105 // ---------------------------------------------------------
       
   106 //
       
   107 void CodLogger::Write
       
   108 ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC8> aFmt, VA_LIST& aList )
       
   109     {
       
   110     if( (aMask & COD_LOG_MASK) && (aLevel <= COD_LOG_LEVEL) )
       
   111         {
       
   112         RFileLogger::WriteFormat
       
   113             (
       
   114             KCodLogDir,
       
   115             KCodLogFile,
       
   116             EFileLoggingModeAppend,
       
   117             aFmt,
       
   118             aList
       
   119             );
       
   120         }
       
   121     }
       
   122 
       
   123 // ---------------------------------------------------------
       
   124 // CodLogger::HexDump()
       
   125 // ---------------------------------------------------------
       
   126 //
       
   127 void CodLogger::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     if( (aMask & COD_LOG_MASK) && (aLevel <= COD_LOG_LEVEL) )
       
   138         {
       
   139         RFileLogger::HexDump
       
   140             (
       
   141             KCodLogDir,
       
   142             KCodLogFile,
       
   143             EFileLoggingModeAppend,
       
   144             aHeader,
       
   145             aMargin,
       
   146             aPtr,
       
   147             aLen
       
   148             );
       
   149         }
       
   150     }
       
   151 
       
   152 #endif /* def __TEST_COD_LOG */