calendarui/inc/CalenLogTools.inl
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2002-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: Log file of Calendar Application.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CALENLOGTOOLS_INL
       
    21 #define CALENLOGTOOLS_INL
       
    22 #include <e32std.h>
       
    23 #include <flogger.h>
       
    24 
       
    25 //#define __CALEN_LOG__
       
    26 #ifdef __CALEN_LOG__
       
    27 
       
    28 _LIT(KLogDir, "calendar");
       
    29 _LIT(KLogFile, "calsvr.log");
       
    30 
       
    31 inline TInt Micro2Milli(const TTimeIntervalMicroSeconds& aX)
       
    32     {
       
    33     return TInt( aX.Int64() / 1000 );
       
    34     }
       
    35 
       
    36 inline void LogTimeStamp(const TDesC& aName, const TInt& aVal) 
       
    37     {
       
    38     TTime timestamp;
       
    39     timestamp.HomeTime();
       
    40 
       
    41     TTime dayBegin(0);
       
    42     dayBegin += timestamp.DaysFrom( dayBegin );
       
    43     TTimeIntervalMicroSeconds microSecs = timestamp.MicroSecondsFrom( dayBegin );
       
    44 
       
    45     RFileLogger log; 
       
    46     log.Connect();
       
    47     log.CreateLog( KLogDir, KLogFile, EFileLoggingModeAppend );
       
    48     log.SetDateAndTime(EFalse, EFalse);
       
    49     log.WriteFormat(_L("%S, %d, %d"), &aName, aVal, Micro2Milli(microSecs));
       
    50     log.Close();
       
    51     }
       
    52 
       
    53 inline void LogTimeStamp(const TDesC& aName) 
       
    54     {
       
    55     TTime timestamp;
       
    56     timestamp.HomeTime();
       
    57 
       
    58     TTime dayBegin(0);
       
    59     dayBegin += timestamp.DaysFrom( dayBegin );
       
    60     TTimeIntervalMicroSeconds microSecs = timestamp.MicroSecondsFrom( dayBegin );
       
    61 
       
    62     RFileLogger log; 
       
    63     log.Connect();
       
    64     log.CreateLog( KLogDir, KLogFile, EFileLoggingModeAppend );
       
    65     log.SetDateAndTime(EFalse, EFalse);
       
    66     log.WriteFormat(_L("%S, %d"), &aName, Micro2Milli(microSecs));
       
    67     log.Close();
       
    68     }
       
    69 
       
    70 #else
       
    71 
       
    72 inline TInt Micro2Milli(const TTimeIntervalMicroSeconds&);
       
    73 inline void LogTimeStamp(const TDesC&, const TInt&);
       
    74 inline void LogTimeStamp(const TDesC&);
       
    75 
       
    76 #endif 
       
    77 
       
    78 #endif // CALENLOGTOOLS_INL