text: #pragma once
  
  #include <string>
  #include <vector>
  
  #include "RE/Skyrim.h"
  #include "SKSE/Logger.h"
  
  namespace Scaleform
  {
      template <class T>
      class Logger :
          public RE::GFxLog
      {
      public:
          inline void LogMessageVarg(LogMessageType, const char* a_fmt, std::va_list a_argList) override
          {
              std::string fmt(a_fmt ? a_fmt : "");
              while (!fmt.empty() && fmt.back() == '\n') {
                  fmt.pop_back();
              }
  
              std::va_list args;
              va_copy(args, a_argList);
              std::vector<char> buf(static_cast<std::size_t>(std::vsnprintf(0, 0, fmt.c_str(), a_argList) + 1));
              std::vsnprintf(buf.data(), buf.size(), fmt.c_str(), args);
              va_end(args);
  
              // Not using the logger abraction here because There is no need to add location data (file name, lines number, etc to scaleform logs.
              spdlog::log(spdlog::level::level_enum::trace, "{}: {}", T::Name().data(), buf.data());
          }
      };
  }
  