debug.cpp
来自「这个刚才那个的源代码」· C++ 代码 · 共 51 行
CPP
51 行
#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 + =
减小字号Ctrl + -
显示快捷键?