10#include "webcface/common/webcface-config.h"
32 std::chrono::system_clock::time_point
time_;
36 LogLineData(
int level, std::chrono::system_clock::time_point time,
46 int level()
const {
return level_; }
47 std::chrono::system_clock::time_point
time()
const {
return time_; }
48 const std::string &
message()
const {
return message_.decode(); };
53 int level()
const {
return level_; }
54 std::chrono::system_clock::time_point
time()
const {
return time_; }
55 const std::wstring &
message()
const {
return message_.decodeW(); };
102 template <
typename F,
typename std::enable_if_t<std::is_invocable_v<F>,
103 std::
nullptr_t> =
nullptr>
106 [callback = std::move(callback)](
const auto &) { callback(); });
115 template <
typename T>
117 onChange(std::forward<T>(callback));
125 const Log &request()
const;
130 std::optional<std::vector<LogLine>> tryGet()
const;
135 std::optional<std::vector<LogLineW>> tryGetW()
const;
140 std::vector<LogLine>
get()
const {
141 return tryGet().value_or(std::vector<LogLine>{});
147 std::vector<LogLineW>
getW()
const {
148 return tryGetW().value_or(std::vector<LogLineW>{});
166 const Log &clear()
const;
179 const Log &
append(
int level, std::string_view message)
const {
180 return append({level, std::chrono::system_clock::now(),
181 SharedString::encode(message)});
190 const Log &
append(
int level, std::chrono::system_clock::time_point time,
191 std::string_view message)
const {
192 return append({level, time, SharedString::encode(message)});
201 const Log &
append(
int level, std::wstring_view message)
const {
202 return append({level, std::chrono::system_clock::now(),
203 SharedString::encode(message)});
212 const Log &
append(
int level, std::chrono::system_clock::time_point time,
213 std::wstring_view message)
const {
214 return append({level, time, SharedString::encode(message)});
221 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Log>,
222 std::
nullptr_t> =
nullptr>
224 return static_cast<Field>(*this) ==
static_cast<Field>(other);
226 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Log>,
227 std::
nullptr_t> =
nullptr>
229 return static_cast<Field>(*this) !=
static_cast<Field>(other);
int level() const
Definition log.h:53
const std::wstring & message() const
Definition log.h:55
LogLineW(const LogLineData &ll)
Definition log.h:52
std::chrono::system_clock::time_point time() const
Definition log.h:54
int level() const
Definition log.h:46
std::chrono::system_clock::time_point time() const
Definition log.h:47
LogLine(const LogLineData &ll)
Definition log.h:45
const std::string & message() const
Definition log.h:48
ログの送受信データを表すクラス
Definition log.h:65
Log(const Field &base, const SharedString &field)
Definition log.h:72
bool operator==(const T &other) const
Logの参照先を比較
Definition log.h:223
const Log & append(int level, std::chrono::system_clock::time_point time, std::string_view message) const
ログを1行追加
Definition log.h:190
bool operator!=(const T &other) const
Definition log.h:228
void appendListener(T &&callback) const
Definition log.h:116
const Log & append(int level, std::chrono::system_clock::time_point time, std::wstring_view message) const
ログを1行追加 (wstring)
Definition log.h:212
const Log & append(int level, std::string_view message) const
ログを1行追加
Definition log.h:179
std::vector< LogLine > get() const
ログを取得する
Definition log.h:140
std::vector< LogLineW > getW() const
ログを取得する (wstring)
Definition log.h:147
const Log & onChange(F callback) const
値が変化したときに呼び出されるコールバックを設定
Definition log.h:104
const Log & append(int level, std::wstring_view message) const
ログを1行追加 (wstring)
Definition log.h:201
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:69
LogLevelEnum
Definition log.h:19
@ warn
Definition log.h:23
@ trace
Definition log.h:20
@ debug
Definition log.h:21
@ critical
Definition log.h:26
@ warning
Definition log.h:24
@ info
Definition log.h:22
@ error
Definition log.h:25
ClientDataの参照とメンバ名とデータ名を持つクラス
Definition field.h:70
std::chrono::system_clock::time_point time_
Definition log.h:32
SharedString message_
Definition log.h:33
#define WEBCFACE_DLL
Definition webcface-config.h:60
#define WEBCFACE_CALL
Definition webcface-config.h:97
#define WEBCFACE_NS_END
Definition webcface-config.h:104
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:103
#define WEBCFACE_CALL_FP
Definition webcface-config.h:98