//                                               Emacs make this -*- mode: C++; -*-
// RcppSpdlog -- wrapping spdlog for use with R

// define R_R_H and USING_R so that REprintf is used, then declare ut
// (including R.h leads to a side-effect with MinGW so minimal is better)
#define R_R_H
#define USING_R
extern "C" {
  void REprintf(const char *, ...);
  void R_FlushConsole(void);
}

// this define is important to not include another logger pulling in stdout
#define SPDLOG_DISABLE_DEFAULT_LOGGER 1

// under C++20 now default to using FMT (as CRAN was nagging)
// but also provide an opt-out
// NB Use of std::format created issues seen in Feb 2026 when R-devel switched
//    So we are parking this for now until this has been sorted out and will stick with fmt
// #if __cplusplus >= 202002L
//   #if !defined(RCPPSPDLOG_DO_NOT_USE_FMT)
//      #if !defined(SPDLOG_USE_STD_FORMAT)
//         #define SPDLOG_USE_STD_FORMAT 1
//      #endif
//   #endif
// #endif

// include main header for spdlog -- others headers needed for extra features
#include "spdlog/spdlog.h"
#include "spdlog/cfg/env.h"

// undefine these two local defines or else Rcpp will nag via r/check_r_headers.h
#undef R_R_H
#undef USING_R
// pulls in stopwatch and template
#include "RcppSpdlog_types.h"

// a custom R sink using Rcpp::Rcout (and Rcpp.h is included too)
#include "rcpp_sink.h"
