#pragma once

// This file overrides the default crow logging framework to use g3 instead.
// It implements enough of the interfaces of the crow logging framework to work correctly
// but deletes the ILogHandler interface, as usage of that would be counter to the g3
// handler management, and would cause performance issues.

#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <string>

#include <g3log/g3log.hpp>
#include <g3log/logworker.hpp>

namespace crow {
enum class LogLevel {
#ifndef ERROR
  DEBUG = 0,
  INFO,
  WARNING,
  ERROR,
  CRITICAL,
#endif

  Debug = 0,
  Info,
  Warning,
  Error,
  Critical,
};

class logger {
 public:
  logger(std::string prefix, LogLevel level) : level_(level) {
    // no op, let g3 handle th log levels
  }

  //
  template <typename T>
  logger& operator<<(T const& value) {
#ifdef CROW_ENABLE_LOGGING
    if (level_ >= get_current_log_level()) {
      stringstream_ << value;
    }
#endif
    return *this;
  }

  //
  static void setLogLevel(LogLevel level) { get_log_level_ref() = level; }

  static LogLevel get_current_log_level() { return get_log_level_ref(); }

 private:
  //
  static LogLevel& get_log_level_ref() {
    static LogLevel current_level = (LogLevel)CROW_LOG_LEVEL;
    return current_level;
  }

  //
  std::ostringstream stringstream_;
  LogLevel level_;
};
}

#define CROW_LOG_CRITICAL LOG(FATAL)
#define CROW_LOG_ERROR LOG(WARNING)
#define CROW_LOG_WARNING LOG(WARNING)
#define CROW_LOG_INFO LOG(INFO)
#define CROW_LOG_DEBUG LOG(DEBUG)
