#ifndef __LOGGER_H_
#define __LOGGER_H_

#include "Definitions.h"
#include <string>

#define LOG Logger::getInstance()->log

class Logger {
  public:
    enum LogLevel {
      LOGLEVEL_NONE = 1,
      LOGLEVEL_LOW = 2,
      LOGLEVEL_MEDIUM = 3,
      LOGLEVEL_HIGH = 4,
      LOGLEVEL_DEBUG = 5
    };
  public:
    static const char * const default_filenameBase;
  protected:
    static const LogLevel default_logLevel;
    static Logger *instance;
    Logger();

    LogLevel logLevel;
    std::string uid;
    char filenameLog[120];
    char filenameReport[120];

  public:
    static Logger * getInstance();
    static void deleteInstance();
    void setLogLevel( LogLevel level );
    const LogLevel getLogLevel() const;
    const char * getFilenameLog() const;
    const char * getFilenameReport() const;
    void generateFilenames( std::string uniqueIdentifier,
                            const char * const filenameBase  = default_filenameBase );

    void log( LogLevel level, const char *format, ... ) const;
    void writeReport( FloatType bestFitness, bool append = true ) const;
};

#endif /* __LOGGER_H_ */
