locationcentre/lcutils/src/lcdebug.cpp
branchRCL_3
changeset 9 4721bd00d3da
parent 8 3a25f69541ff
child 11 e15b7f06eba6
equal deleted inserted replaced
8:3a25f69541ff 9:4721bd00d3da
     1 /*
       
     2 * Copyright (c)  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:  Utility class for Debug traces
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "lcdebug.h"
       
    21 #include <flogger.h>
       
    22 #include <e32svr.h>
       
    23 
       
    24 // ========================== EXPORTED FUNCTIONS =========================
       
    25 
       
    26 #ifdef _LCDEBUG
       
    27 
       
    28 /// Folder where the log resides
       
    29 _LIT( KLogFolder, "Location" );
       
    30 
       
    31 /// The name of the log file
       
    32 _LIT( KLogFileName, "Location" );
       
    33 
       
    34 /// How many characters a log line can contain
       
    35 const TInt KLogLineLength = 256;
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 //  void Debug( TRefByValue<const TDesC> aText, ... )
       
    39 // -----------------------------------------------------------------------------
       
    40 //
       
    41 EXPORT_C void Debug( TRefByValue<const TDesC> aText, ... )
       
    42     {
       
    43     RDebug::Print(aText);
       
    44 
       
    45     VA_LIST args;
       
    46     VA_START( args, aText );
       
    47 
       
    48     TBuf<KLogLineLength> buf;
       
    49     buf.FormatList( aText, args );
       
    50     RFileLogger logger;
       
    51     TInt ret=logger.Connect();
       
    52     if (ret==KErrNone)
       
    53         {
       
    54         logger.SetDateAndTime( EFalse,EFalse );
       
    55         logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend );
       
    56         logger.Write(buf);
       
    57         }
       
    58     logger.Close();
       
    59 
       
    60     VA_END( args );
       
    61     }
       
    62 
       
    63 #else
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 //  void Debug( TRefByValue<const TDesC> aText, ... )
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 EXPORT_C void Debug( TRefByValue<const TDesC> /* aText */, ... )
       
    70     {
       
    71     }
       
    72     
       
    73 #endif
       
    74 
       
    75 //  End of File