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