gssettingsuis/Gs/Logger/GsLogger.h
changeset 0 8c5d936e5675
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     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 "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 *       Macro definition file for logging.
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef GSLOGGER_H
       
    23 #define GSLOGGER_H
       
    24 
       
    25 #include "GsLoggingConfiguration.h"
       
    26 #include <e32std.h>
       
    27 #include <e32svr.h>
       
    28 #include <flogger.h>
       
    29 
       
    30 _LIT( KLogsDir,                  "Gs");
       
    31 _LIT( KLogFileName,              "Gs.log");
       
    32 
       
    33 /*
       
    34  We have 3 possible logging methods:
       
    35 
       
    36  set GS_LOGGING_METHOD to 0 to get no logging at all
       
    37  set GS_LOGGING_METHOD to 1 to get logging via RDebug::Print
       
    38  set GS_LOGGING_METHOD to 2 to get logging to log file
       
    39 
       
    40  Switching on/off is done in the Configuration file (GsLoggingConfiguration.h)
       
    41  */
       
    42 
       
    43 #if ( defined (_GSLOGGING) )
       
    44     #if ( defined (_GS_LOGGING_TO_FILE))
       
    45         #define GS_LOGGING_METHOD 2
       
    46     #else
       
    47         #define GS_LOGGING_METHOD 1
       
    48     #endif
       
    49 #else
       
    50     #define GS_LOGGING_METHOD 0
       
    51 #endif
       
    52 
       
    53 
       
    54 #if (GS_LOGGING_METHOD==0)
       
    55     #define __GSLOGSTRING(C)
       
    56     #define __GSLOGSTRING1(C, X)
       
    57     #define __GSLOGSTRING2(C, X, Y)
       
    58     #define __GSLOGSTRING3(C, X, Y, Z)
       
    59     #define __GSLOGSTRING4(C, X, Y, Z, A)
       
    60 #endif
       
    61 #if (GS_LOGGING_METHOD==1)
       
    62     #define __GSLOGSTRING(C)                RDebug::Print(_L(C));
       
    63     #define __GSLOGSTRING1(C, X)            RDebug::Print(_L(C),X);
       
    64     #define __GSLOGSTRING2(C, X, Y)         RDebug::Print(_L(C),X, Y);
       
    65     #define __GSLOGSTRING3(C, X, Y, Z)      RDebug::Print(_L(C),X, Y, Z);
       
    66     #define __GSLOGSTRING4(C, X, Y, Z, A)   RDebug::Print(_L(C),X, Y, Z, A);
       
    67 #endif
       
    68 #if (GS_LOGGING_METHOD==2)
       
    69     #define __GSLOGSTRING(C)                {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, tempLogDes());}
       
    70     #define __GSLOGSTRING1(C, X)            {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X);}
       
    71     #define __GSLOGSTRING2(C, X, Y)         {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y);}
       
    72     #define __GSLOGSTRING3(C, X, Y, Z)      {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y,Z);}
       
    73     #define __GSLOGSTRING4(C, X, Y, Z, A)   {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y,Z,A);}
       
    74 #endif
       
    75 
       
    76 #endif // GSLOGGER_H