homescreenpluginsrv/hspstools/inc/hspslogbusfile.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Header for ChspsLogBusFile.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HSPS_LOGBUSFILE_H
       
    20 #define HSPS_LOGBUSFILE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <hspslogbus.h>
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include <flogger.h>
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31  * ChspsLogBus implementation that logs into RFileLogger.
       
    32  * 
       
    33  * @lib hspsTools.lib
       
    34  * @since S60 5.0
       
    35  * @ingroup group_homescreenpluginservice_tools
       
    36  */
       
    37 class ChspsLogBusFile : public ChspsLogBus
       
    38     {
       
    39 public:
       
    40     // Constructors and destructor
       
    41 
       
    42     /**
       
    43      * Destructor.
       
    44      */
       
    45     IMPORT_C ~ChspsLogBusFile();
       
    46 
       
    47     /**
       
    48      * Two-phased constructor.
       
    49      * 
       
    50      * @since S60 5.0
       
    51      * @param   aLoggingFile            Target file name.
       
    52      * @param   aLoggingDirectory       Target folder.
       
    53      */
       
    54     IMPORT_C static ChspsLogBusFile* NewL( const TDesC& aLoggingFile,
       
    55                                            const TDesC& aLoggingDirectory = KNullDesC() );
       
    56 
       
    57     /**
       
    58      * Two-phased constructor.
       
    59      * 
       
    60      * @since S60 5.0
       
    61      * @param   aLoggingFile            Target file name.
       
    62      * @param   aLoggingDirectory       Target folder.
       
    63      */
       
    64     IMPORT_C static ChspsLogBusFile* NewLC( const TDesC& aLoggingFile,
       
    65                                             const TDesC& aLoggingDirectory = KNullDesC() );
       
    66 
       
    67     /**
       
    68      * Create log file name easily with format "baseline_<timestamp>.log"
       
    69      * 
       
    70      * @since S60 5.0
       
    71      * @param   aBaseline   Baseline text.
       
    72      * @return  TFileName   Newly created file name.
       
    73      */
       
    74     IMPORT_C static TFileName CreateLogFilename( const TDesC& aBaseline );
       
    75     
       
    76 private: // Methods.
       
    77     /**
       
    78      * From ChspsLogBus.
       
    79      * 
       
    80      * This method must be overwritten in inherited class (implementation).
       
    81      * Implementation must log given string using logging channel of
       
    82      * it's choice.
       
    83      * 
       
    84      * @param aMessage Message to be logged.
       
    85      */    
       
    86     virtual void _LogText( const TDesC& aMessage);    
       
    87     
       
    88     /**
       
    89      * Constructor for performing 1st stage construction
       
    90      */
       
    91     ChspsLogBusFile();
       
    92 
       
    93     /**
       
    94      * EPOC default constructor for performing 2nd stage construction
       
    95      *
       
    96      * @param   aLoggingFile          Target file name.
       
    97      * @param   aLoggingDirectory     Target folder.  
       
    98      */
       
    99     void ConstructL( const TDesC& aLoggingFile,
       
   100                      const TDesC& aLoggingDirectory );
       
   101 
       
   102 private: // Data.
       
   103     /**
       
   104      * Handle to file logger.
       
   105      */
       
   106     RFileLogger iFileLogger;
       
   107 
       
   108     /**
       
   109      * Name of logging file.
       
   110      */
       
   111     HBufC* iLoggingFile;
       
   112 
       
   113     /**
       
   114      * Name of logging directory.
       
   115      */
       
   116     HBufC* iLoggingDirectory;
       
   117     };
       
   118 
       
   119 #endif // HSPS_LOGBUSFILE_H