/*
 *  Open BEAGLE
 *  Copyright (C) 2001-2004 by Christian Gagne and Marc Parizeau
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *  Contact:
 *  Laboratoire de Vision et Systemes Numeriques
 *  Departement de genie electrique et de genie informatique
 *  Universite Laval, Quebec, Canada, G1V 4J7
 *  http://vision.gel.ulaval.ca
 *
 */

/*!
 *  \file   beagle/LoggerXML.hpp
 *  \brief  Definition of the class LoggerXML.
 *  \author Christian Gagne
 *  \author Marc Parizeau
 *  $Revision: 1.3 $
 *  $Date: 2004/03/31 19:09:39 $
 */
 
#ifndef Beagle_LoggerXML_hpp
#define Beagle_LoggerXML_hpp

#include "beagle/config.hpp"
#include "beagle/macros.hpp"
#include "beagle/Logger.hpp"

namespace Beagle {

/*!
 *  \class LoggerXML beagle/LoggerXML.hpp "beagle/LoggerXML.hpp"
 *  \brief Beagle's XML logger class. Log to in a XML format to file or console.
 *  \ingroup ECF
 */
class LoggerXML : public Logger {
  
public:

  //! LoggerXML allocator type.
  typedef AllocatorT<LoggerXML,Logger::Alloc>
          Alloc;
  //! LoggerXML handle type.
  typedef PointerT<LoggerXML,Logger::Handle>
          Handle;
  //! LoggerXML bag type.
  typedef ContainerT<LoggerXML,Logger::Bag>
          Bag;

           LoggerXML();
  virtual ~LoggerXML();

  virtual void initialize(System& ioSystem);
  virtual void outputMessage(unsigned int inLevel,
                             std::string inType,
                             std::string inClass,
                             std::string inMessage);
  virtual void outputObject(unsigned int inLevel,
                            std::string inType,
                            std::string inClass,
                            const Object& inObject);
  virtual void terminate();
                            
  
protected:
  String::Handle      mLogFileName;     //!< File name to log output into.
  Bool::Handle        mConsoleEnabled;  //!< Flag whether console logging is enabled.
  Bool::Handle        mShowLevel;       //!< Show log level in logs.
  Bool::Handle        mShowType;        //!< Show type of message in logs.
  Bool::Handle        mShowClass;       //!< Show class that output the message in logs.
  std::string         mActualFileName;  //!< Actual filename used to log message.
  XMLStreamer::Handle mStreamerFile;    //!< Streamer used to output messages in file.
  std::ofstream*      mLogOutStream;    //!< Pointer to stream to log output.
  XMLStreamer::Handle mStreamerConsole; //!< Streamer used to output messages at standard output.
  bool                mTerminated;      //!< Flag whether logger is terminated or not.
  
public:
  LoggerXML(const LoggerXML& inLoggerXML);              // Copy constructor prohibited!
  LoggerXML& operator=(const LoggerXML& inLoggerXML);   // operator= prohibited!
  
};

}

#endif // Beagle_LoggerXML_hpp

