homescreenpluginsrv/hspstools/inc/hspslogbusfile.h
author jake
Tue, 13 Apr 2010 15:07:27 +0300
branchv5backport
changeset 56 7b5c31fac191
parent 0 79c6a41cd166
permissions -rw-r--r--
Many of the components were not compilingm,because bld.inf had undefined flag #ifdef RD_CUSTOMIZABLE_AI. All the flags removed now. Components do not compile right away. E.g. many icons are missing and need to be copied from Symbian3. See example from MCSPlugin. Shortcut plugin does not need to be compiled as MCSPlugin replaces it.

/*
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Header for ChspsLogBusFile.
*
*/


#ifndef HSPS_LOGBUSFILE_H
#define HSPS_LOGBUSFILE_H

// INCLUDES
#include <hspslogbus.h>
#include <e32std.h>
#include <e32base.h>
#include <flogger.h>

// CLASS DECLARATION

/**
 * ChspsLogBus implementation that logs into RFileLogger.
 * 
 * @lib hspsTools.lib
 * @since S60 5.0
 * @ingroup group_homescreenpluginservice_tools
 */
class ChspsLogBusFile : public ChspsLogBus
    {
public:
    // Constructors and destructor

    /**
     * Destructor.
     */
    IMPORT_C ~ChspsLogBusFile();

    /**
     * Two-phased constructor.
     * 
     * @since S60 5.0
     * @param   aLoggingFile            Target file name.
     * @param   aLoggingDirectory       Target folder.
     */
    IMPORT_C static ChspsLogBusFile* NewL( const TDesC& aLoggingFile,
                                           const TDesC& aLoggingDirectory = KNullDesC() );

    /**
     * Two-phased constructor.
     * 
     * @since S60 5.0
     * @param   aLoggingFile            Target file name.
     * @param   aLoggingDirectory       Target folder.
     */
    IMPORT_C static ChspsLogBusFile* NewLC( const TDesC& aLoggingFile,
                                            const TDesC& aLoggingDirectory = KNullDesC() );

    /**
     * Create log file name easily with format "baseline_<timestamp>.log"
     * 
     * @since S60 5.0
     * @param   aBaseline   Baseline text.
     * @return  TFileName   Newly created file name.
     */
    IMPORT_C static TFileName CreateLogFilename( const TDesC& aBaseline );
    
private: // Methods.
    /**
     * From ChspsLogBus.
     * 
     * This method must be overwritten in inherited class (implementation).
     * Implementation must log given string using logging channel of
     * it's choice.
     * 
     * @param aMessage Message to be logged.
     */    
    virtual void _LogText( const TDesC& aMessage);    
    
    /**
     * Constructor for performing 1st stage construction
     */
    ChspsLogBusFile();

    /**
     * EPOC default constructor for performing 2nd stage construction
     *
     * @param   aLoggingFile          Target file name.
     * @param   aLoggingDirectory     Target folder.  
     */
    void ConstructL( const TDesC& aLoggingFile,
                     const TDesC& aLoggingDirectory );

private: // Data.
    /**
     * Handle to file logger.
     */
    RFileLogger iFileLogger;

    /**
     * Name of logging file.
     */
    HBufC* iLoggingFile;

    /**
     * Name of logging directory.
     */
    HBufC* iLoggingDirectory;
    };

#endif // HSPS_LOGBUSFILE_H