accesspointcontrol/apcontrollistplugin/src/apcontrollistpluginlogger.cpp
changeset 27 489cf6208544
parent 23 7ec726f93df1
child 42 017c42709822
child 46 95d45f234cf3
equal deleted inserted replaced
23:7ec726f93df1 27:489cf6208544
     1 /*
       
     2 * Copyright (c) 2006 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 APControlListPluginLogger.   
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #ifdef _DEBUG
       
    23 
       
    24     #include "apcontrollistpluginlogger.h"
       
    25     #include <flogger.h>
       
    26 	#include <eikenv.h>
       
    27 
       
    28     // ================= CONSTANTS =======================
       
    29 
       
    30     /// apcontrollistplugin logging directory.
       
    31     _LIT( KapcontrollistpluginLogDir, "apcontrollistplugin" );
       
    32     /// apcontrollistplugin log file name.
       
    33     _LIT( KapcontrollistpluginLogFile, "apcontrollistplugin.txt" );
       
    34 
       
    35 
       
    36     // ================= MEMBER FUNCTIONS =======================
       
    37 
       
    38     // ---------------------------------------------------------
       
    39     // APControlListPluginLogger::Write()
       
    40     // ---------------------------------------------------------
       
    41     //
       
    42     void APControlListPluginLogger::Write
       
    43     ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC16> aFmt, ... )
       
    44         {
       
    45         if( (aMask & APCONTROL_LIST_LOG_MASK) && (aLevel <= APCONTROL_LIST_LOG_LEVEL) )
       
    46             {
       
    47             VA_LIST list;
       
    48             VA_START( list, aFmt );
       
    49             RFileLogger::WriteFormat
       
    50                 (
       
    51                 KapcontrollistpluginLogDir,
       
    52                 KapcontrollistpluginLogFile,
       
    53                 EFileLoggingModeAppend,
       
    54                 aFmt,
       
    55                 list
       
    56                 );
       
    57             VA_END( list );
       
    58             }
       
    59         }
       
    60 
       
    61 
       
    62     // ---------------------------------------------------------
       
    63     // APControlListPluginLogger::Write()
       
    64     // ---------------------------------------------------------
       
    65     //
       
    66     void APControlListPluginLogger::Write
       
    67     ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC16> aFmt, 
       
    68       VA_LIST& aList )
       
    69         {
       
    70         if( (aMask & APCONTROL_LIST_LOG_MASK) && (aLevel <= APCONTROL_LIST_LOG_LEVEL) )
       
    71             {
       
    72             RFileLogger::WriteFormat
       
    73                 (
       
    74                 KapcontrollistpluginLogDir,
       
    75                 KapcontrollistpluginLogFile,
       
    76                 EFileLoggingModeAppend,
       
    77                 aFmt,
       
    78                 aList
       
    79                 );
       
    80             }
       
    81         }
       
    82 
       
    83 
       
    84     // ---------------------------------------------------------
       
    85     // APControlListPluginLogger::Write()
       
    86     // ---------------------------------------------------------
       
    87     //
       
    88     void APControlListPluginLogger::Write
       
    89     ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC8> aFmt, ... )
       
    90         {
       
    91         if( (aMask & APCONTROL_LIST_LOG_MASK) && (aLevel <= APCONTROL_LIST_LOG_LEVEL) )
       
    92             {
       
    93             VA_LIST list;
       
    94             VA_START( list, aFmt );
       
    95             RFileLogger::WriteFormat
       
    96                 (
       
    97                 KapcontrollistpluginLogDir,
       
    98                 KapcontrollistpluginLogFile,
       
    99                 EFileLoggingModeAppend,
       
   100                 aFmt,
       
   101                 list
       
   102                 );
       
   103             VA_END( list );
       
   104             }
       
   105         }
       
   106 
       
   107 
       
   108     // ---------------------------------------------------------
       
   109     // APControlListPluginLogger::Write()
       
   110     // ---------------------------------------------------------
       
   111     //
       
   112     void APControlListPluginLogger::Write
       
   113     ( TInt32 aMask, TInt aLevel, TRefByValue<const TDesC8> aFmt, 
       
   114       VA_LIST& aList )
       
   115         {
       
   116         if( (aMask & APCONTROL_LIST_LOG_MASK) && (aLevel <= APCONTROL_LIST_LOG_LEVEL) )
       
   117             {
       
   118             RFileLogger::WriteFormat
       
   119                 (
       
   120                 KapcontrollistpluginLogDir,
       
   121                 KapcontrollistpluginLogFile,
       
   122                 EFileLoggingModeAppend,
       
   123                 aFmt,
       
   124                 aList
       
   125                 );
       
   126             }
       
   127         }
       
   128 
       
   129 
       
   130     // ---------------------------------------------------------
       
   131     // APControlListPluginLogger::HexDump()
       
   132     // ---------------------------------------------------------
       
   133     //
       
   134     void APControlListPluginLogger::HexDump
       
   135             (
       
   136             TInt32 aMask,
       
   137             TInt aLevel, 
       
   138             const TText* aHeader,
       
   139             const TText* aMargin,
       
   140             const TUint8* aPtr,
       
   141             TInt aLen
       
   142             )
       
   143         {
       
   144         if( (aMask & APCONTROL_LIST_LOG_MASK) && (aLevel <= APCONTROL_LIST_LOG_LEVEL) )
       
   145             {
       
   146             RFileLogger::HexDump
       
   147                 (
       
   148                 KapcontrollistpluginLogDir,
       
   149                 KapcontrollistpluginLogFile,
       
   150                 EFileLoggingModeAppend,
       
   151                 aHeader,
       
   152                 aMargin,
       
   153                 aPtr,
       
   154                 aLen
       
   155                 );
       
   156             }
       
   157         }
       
   158                 
       
   159     // ---------------------------------------------------------
       
   160     // APControlListPluginLogger::FCreate()
       
   161     // ---------------------------------------------------------
       
   162     //
       
   163 	void APControlListPluginLogger::FCreate()
       
   164 	    {
       
   165 	    TFileName path(_L("c:\\logs\\"));
       
   166 	    path.Append(KapcontrollistpluginLogDir);
       
   167 	    path.Append(_L("\\"));
       
   168 	    RFs& fs = CEikonEnv::Static()->FsSession();
       
   169 	    fs.MkDirAll(path);
       
   170 	    }
       
   171 #endif // _DEBUG
       
   172