when.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "clog/richLog.hpp"
5
6namespace by {
7
8#undef __WHEN_OBJECT__
9#define __WHEN_OBJECT__ __clog_when__
10
15 class _nout __WHEN_OBJECT__: public __indep_when__ {
16 BY(ME(__WHEN_OBJECT__))
17
18 public:
19 static const me& get();
20
21 template <typename... Ts> const me& err(const nchar* fmt, const Ts&... args) const {
22 ::by::richLog(::by::errLv::ERR, __FILENAME__, __func__, __LINE__, (std::string(fmt) + "\n").c_str(),
23 args...);
24 return *this;
25 }
26
27 template <typename... Ts> const me& warn(const nchar* fmt, const Ts&... args) const {
28 ::by::richLog(::by::errLv::WARN, __FILENAME__, __func__, __LINE__, (std::string(fmt) + "\n").c_str(),
29 args...);
30 return *this;
31 }
32
33 template <typename... Ts> const me& info(const nchar* fmt, const Ts&... args) const {
34 ::by::richLog(::by::errLv::INFO, __FILENAME__, __func__, __LINE__, (std::string(fmt) + "\n").c_str(),
35 args...);
36 return *this;
37 }
38
39 template <typename... Ts> const me& dbgErr(const nchar* fmt, const Ts&... args) const {
40 ::by::dbgRichLog(::by::errLv::ERR, __FILENAME__, __func__, __LINE__, (std::string(fmt) + "\n").c_str(),
41 args...);
42 return *this;
43 }
44
45 template <typename... Ts> const me& dbgWarn(const nchar* fmt, const Ts&... args) const {
46 ::by::dbgRichLog(::by::errLv::WARN, __FILENAME__, __func__, __LINE__, (std::string(fmt) + "\n").c_str(),
47 args...);
48 return *this;
49 }
50
51 template <typename... Ts> const me& dbgInfo(const nchar* fmt, const Ts&... args) const {
52 ::by::dbgRichLog(::by::errLv::INFO, __FILENAME__, __func__, __LINE__, (std::string(fmt) + "\n").c_str(),
53 args...);
54 return *this;
55 }
56 };
57} // namespace by
Conditional logging utility for clog module.
Definition: when.hpp:15
Function call arguments container.
Definition: args.hpp:13
Standard error implementation.
Definition: err.hpp:11