⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debug.cpp

📁 这个刚才那个的源代码
💻 CPP
字号:
#include "Debug.h"

#ifdef CORONA_DEBUG


FILE* Log::handle;
int Log::indent_count;


////////////////////////////////////////////////////////////////////////////////

void
Log::Write(const char* str)
{
  EnsureOpen();
  if (handle) {
    std::string s(std::string(indent_count * 2, ' ') + str + "\n");
    fputs(s.c_str(), handle);
    fflush(handle);
  }
}

////////////////////////////////////////////////////////////////////////////////

void
Log::EnsureOpen()
{
  if (!handle) {
#ifdef WIN32
    handle = fopen("C:/corona_debug.log", "w");
#else
    std::string home(getenv("HOME"));
    handle = fopen((home + "/corona_debug.log").c_str(), "w");
#endif
    atexit(Close);
  }
}

////////////////////////////////////////////////////////////////////////////////

void
Log::Close()
{
  fclose(handle);
}

////////////////////////////////////////////////////////////////////////////////


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -