/**
* Logger.h
* 
*class of Logger
*
* Created by gyhuang@telenav.cn on 18/Feb/2011
* Copyright 2011 Telenav Inc. All rights reserved.
*
*/

#ifndef LOGGER_H_
#define LOGGER_H_

#include <string>

namespace Tn
{
namespace Foundation
{

enum Logger_Priority
{
    Logger_Priority_Error,
    Logger_Priority_Warn,
    Logger_Priority_Info
};

enum Logger_FilterLevel
{
    Logger_FilterLevel_Disable,
    Logger_FilterLevel_Error,
    Logger_FilterLevel_Warn,
    Logger_FilterLevel_Info
};

enum Logger_Output
{
    Logger_Output_Default = 1,
    Logger_Output_Console = 1, 
    Logger_Output_File = 2,
    Logger_Output_Server = 4
};

class Logger {
public:
    virtual ~Logger() {};

    /**
     * set log file path, please make sure to call it before writing anything to log file
     */
    virtual void SetPath(std::string path) = 0 ;
            
    /**
     * set log filter's level. 
     * set to Logger_FilterLevel_Info means output all the log;
     * set to Logger_FilterLevel_Warn means output just Warn and Error;
     * set to Logger_FilterLevel_Error means output just Error;
     * set to Logger_FilterLevel_Disable means ouput nothing;
     */
    virtual void SetFilterLevel(Logger_FilterLevel level) = 0;

    /**
     * set log file name,the derived class should have a default filename like "default.log";
     */
    virtual void SetLogFileName(std::string filename) = 0;

    /*********when want to print log ,use g_pTnLogger->Log()***********************************************************/
    virtual int Log(Logger_Priority priority, std::string msg, int outputDest = Logger_Output_Default) = 0;
            
    virtual int LogToBuffer(Logger_Priority priority, std::string msg) = 0;
};

} // namepsace Foundation

} // namespace Tn

#endif
