34 template <
typename T>
struct noWrap {
35 noWrap(T rhs): data(rhs) {}
37 T unwrap()
const {
return data; }
43 static_assert(
true,
"not supported wrapper for richLog");
47 strWrap(
const std::string& rhs);
48 const nchar* unwrap()
const;
52 template <
typename T,
bool Signed,
int Size>
53 using tifIntType =
typename std::enable_if<std::is_integral_v<T> ==
true && std::is_signed<T>{} == Signed &&
54 sizeof(T) * 8 == Size>::type;
56 template <
typename T> noWrap<T> __convert__(T rhs, tifIntType<T, true, 32>* =
nullptr) {
return rhs; }
58 template <
typename T> noWrap<T> __convert__(T rhs, tifIntType<T, true, 64>* =
nullptr) {
return rhs; }
60 template <
typename T> noWrap<T> __convert__(T rhs, tifIntType<T, false, 32>* =
nullptr) {
return rhs; }
62 template <
typename T> noWrap<T> __convert__(T rhs, tifIntType<T, false, 64>* =
nullptr) {
return rhs; }
64 _nout noWrap<nflt> __convert__(nflt rhs);
65 _nout noWrap<nflt> __convert__(nflt* rhs);
66 _nout noWrap<nchar> __convert__(nchar rhs);
67 _nout noWrap<const nchar*> __convert__(nchar* rhs);
68 _nout noWrap<const nchar*> __convert__(
const nchar* rhs);
69 _nout strWrap __convert__(nbool rhs);
70 _nout strWrap __convert__(nbool* rhs);
71 _nout noWrap<ndbl> __convert__(ndbl rhs);
72 _nout noWrap<ndbl> __convert__(ndbl* rhs);
73 _nout noWrap<nshort> __convert__(nshort rhs);
74 _nout noWrap<nshort> __convert__(nshort* rhs);
75 _nout noWrap<nushort> __convert__(nushort rhs);
76 _nout noWrap<nushort> __convert__(nushort* rhs);
77 _nout strWrap __convert__(
const std::string* rhs);
78 _nout strWrap __convert__(
const std::string& rhs);
79 _nout strWrap __convert__(
void* rhs);
81 template <
typename... Ts>
82 void richLog(errLv::level lv,
const std::string& filename,
const nchar* func, nint line,
const nchar* fmt,
84 ::by::logger::get().log(lv, filename, func, line, fmt, __convert__((
const Ts&) args).unwrap()...);
87 template <
typename... Ts>
88 void dbgRichLog(errLv::level lv,
const std::string& filename,
const nchar* func, nint line,
const nchar* fmt,
91 ::by::logger::get().log(lv, filename, func, line, fmt, __convert__((
const Ts&) args).unwrap()...);
static logger & get()
Get singleton logger instance
Rich logging support with polymorphic type conversion
Definition richLog.hpp:34
Definition richLog.hpp:46
Definition richLog.hpp:42