28 #ifndef YCL_INC_Debug_h_
29 #define YCL_INC_Debug_h_ 1
32 #include YFM_YCLib_YCommon
34 #if YF_Multithread == 1
66 # ifndef YCL_Use_TraceSrc
67 # define YCL_Use_TraceSrc 1
119 #if defined _WIN32 && !defined __USE_MINGW_ANSI_STDIO
138 using Filter = std::function<bool(Level, Logger&)>;
139 using Sender = std::function<void(Level, Logger&, const char*)>;
148 #if YF_Multithread == 1
149 std::recursive_mutex record_mtx;
183 DoLog(Level, const
char*);
184 PDefH(
void, DoLog, Level lv, const std::
string& str)
185 ImplRet(DoLog(lv, str.c_str()))
193 DoLogException(Level level, const std::exception&) ynothrow;
197 FetchDefaultSender(const std::
string& = "YFramework");
199 template<typename _fCaller, typename... _tParams>
201 Log(Level level, _fCaller&&
f, _tParams&&...
args)
203 if(filter(level, *
this))
208 catch(std::exception& e)
210 DoLogException(level, e);
240 #define YCL_Log(_lv, ...) platform::FetchCommonLogger().Log(_lv, __VA_ARGS__)
249 # define YCL_Trace(_lv, ...) \
251 return platform::LogWithSource(__FILE__, __LINE__, __VA_ARGS__); \
254 # define YCL_Trace(_lv, ...) \
255 YCL_Log(_lv, [&]{return ystdex::sfmt(__VA_ARGS__);})
267 # define YTraceDe(_lv, ...) YCL_Trace(_lv, __VA_ARGS__)
269 # define YTraceDe(...)
274 namespace platform_ex
286 LogAssert(
bool,
const char*,
const char*,
int,
const char*);
290 # define YAssert(_expr, _msg) \
292 platform_ex::LogAssert(_expr, #_expr, __FILE__, __LINE__, _msg)
316 class YF_API AndroidLogSender
320 using Level = Logger::Level;
333 operator()(Level, Logger&,
const char*)
const;
#define ynothrowv
YSLib 无异常抛出保证验证:有条件地使用无异常抛出规范。
yconstfn const string _tParams && args
YF_API void YDebugBegin()
调试模式:显示控制台。
#define DefDeCopyCtor(_t)
std::function< bool(Level, Logger &)> Filter
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
#define DefGetter(_q, _t, _n,...)
yconstfn Integer &Trait::AMask Trait::XYZBitsN yconstfn DefGetter(const ynothrow, typename Trait::BType, B, Integer &Trait::XMask) yconstfn DefGetter(const ynothrow
YF_API void YDebugSetStatus(bool=true)
调试模式:设置状态。
std::size_t size ynothrow
#define DefDeMoveCtor(_t)
std::string LogWithSource(const char *file, int line, const char *fmt,...)
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
GSStringTemplate< char >::basic_string string
YF_API Logger & FetchCommonLogger()
取公共日志记录器。
yconstexpr const KeyInput KeyIndex ynothrow ImplRet(char()) namespace KeyCodes
本机按键编码。
YF_API bool YDebugGetStatus()
调试模式:取得状态。
union YB_ATTR(packed) YB_ATTR(aligned(yalignof(typename XYZATrait< _vB
BGRA 四元组。
YF_API int yprintf(const char *,...)
调试模式 printf :显示控制台格式化输出 ,按键继续。
YF_API void YDebug()
调试模式:按键继续。
PDefH(bool, ufexists, const _tString &str) ynothrow ImplRet(ufexists(str.c_str())) YF_API char16_t *u16getcwd_n(char16_t *buf
判断指定字符串为文件名的文件是否存在。
std::function< void(Level, Logger &, const char *)> Sender