usbuis/imageprintui/inc/imageprintuidebug.h
changeset 93 2dc695882abd
parent 89 3592750162a5
equal deleted inserted replaced
89:3592750162a5 93:2dc695882abd
     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:  Log file for Image Print UI
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IMAGEPRINTUIDEBUG_H
       
    20 #define IMAGEPRINTUIDEBUG_H
       
    21 
       
    22 #ifdef _DEBUG
       
    23 
       
    24 #include <e32svr.h>
       
    25 #include <e32std.h>
       
    26 
       
    27 // ===========================================================================
       
    28 #ifdef __WINS__     // File logging for WINS
       
    29 // ===========================================================================
       
    30 #define FLOG(a)   { FPrint(a); }
       
    31 #define FTRACE(a) { a; }
       
    32 
       
    33 #include <f32file.h>
       
    34 #include <flogger.h>
       
    35 
       
    36 _LIT(KLogFile,"imageprintui.txt");
       
    37 _LIT(KLogDirFullName,"c:\\logs\\imageprint\\");
       
    38 _LIT(KLogDir,"imageprint");
       
    39 
       
    40 // Declare the FPrint function
       
    41 inline void FPrint(const TRefByValue<const TDesC> aFmt, ...)
       
    42     {
       
    43     VA_LIST list;
       
    44     VA_START(list,aFmt);
       
    45     RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend,
       
    46         aFmt, list);
       
    47     }
       
    48 
       
    49 // ===========================================================================
       
    50 #else               // RDebug logging for target HW
       
    51 // ===========================================================================
       
    52 #define FLOG(a) { RDebug::Print(a);  }
       
    53 #define FTRACE(a) { a; }
       
    54 
       
    55 inline void FPrint(const TRefByValue<const TDesC16> aFmt, ...)
       
    56     {
       
    57     VA_LIST list;
       
    58     VA_START(list,aFmt);
       
    59     TInt tmpInt = VA_ARG(list, TInt);
       
    60     TInt tmpInt2 = VA_ARG(list, TInt);
       
    61     TInt tmpInt3 = VA_ARG(list, TInt);
       
    62     VA_END(list);
       
    63     RDebug::Print(aFmt, tmpInt, tmpInt2, tmpInt3);
       
    64     }
       
    65 
       
    66 inline void FPrint(TRefByValue<const TDesC8> aFmt, ...)
       
    67     {
       
    68 
       
    69 	VA_LIST list;
       
    70 	VA_START(list, aFmt);
       
    71     TBuf8<256> buf8;
       
    72 	buf8.AppendFormatList(aFmt, list);
       
    73 
       
    74     TBuf16<256> buf16(buf8.Length());
       
    75     buf16.Copy(buf8);
       
    76 
       
    77     TRefByValue<const TDesC> tmpFmt(_L("%S"));
       
    78     RDebug::Print(tmpFmt, &buf16);
       
    79     }
       
    80 
       
    81 #endif //__WINS__
       
    82 
       
    83 // ===========================================================================
       
    84 #else // // No loggings --> Reduced binary size
       
    85 // ===========================================================================
       
    86 #define FLOG(a)
       
    87 #define FTRACE(a)
       
    88 
       
    89 #endif // _DEBUG
       
    90 
       
    91 
       
    92 #endif // IMAGEPRINTDEBUG_H
       
    93 
       
    94 // End of File