SkyWay Linux SDK
読み取り中…
検索中…
一致する文字列を見つけられません
logger.hpp
1//
2// © NTT DOCOMO BUSINESS, Inc. All Rights Reserved.
3//
4
5#ifndef SKYWAY_GLOBAL_LOGGER_HPP
6#define SKYWAY_GLOBAL_LOGGER_HPP
7
8#include <mutex>
9
10#include <rtc_base/logging.h>
11
12#include <skyway/global/interface/logger.hpp>
13
14namespace skyway {
15namespace global {
16
18class Logger : public interface::Logger, public rtc::LogSink {
19public:
24 class Listener {
25 public:
26 virtual ~Listener() = default;
31 virtual void OnLog(Level level, const std::string& text) = 0;
32 };
33
36 Logger(Level level = kInfo, bool enable_webrtc_log = false);
37 ~Logger();
38
41 void Log(Level level,
42 const std::string& message,
43 const std::string& filename = "",
44 const std::string& function = "",
45 int line = -1);
46
49 void Trace(const std::string& message,
50 const std::string& filename = __builtin_FILE(),
51 const std::string& function = __builtin_FUNCTION(),
52 int line = __builtin_LINE()) override;
55 void Debug(const std::string& message,
56 const std::string& filename = __builtin_FILE(),
57 const std::string& function = __builtin_FUNCTION(),
58 int line = __builtin_LINE()) override;
61 void Info(const std::string& message,
62 const std::string& filename = __builtin_FILE(),
63 const std::string& function = __builtin_FUNCTION(),
64 int line = __builtin_LINE()) override;
67 void Warn(const std::string& message,
68 const std::string& filename = __builtin_FILE(),
69 const std::string& function = __builtin_FUNCTION(),
70 int line = __builtin_LINE()) override;
73 void Error(const std::string& message,
74 const std::string& filename = __builtin_FILE(),
75 const std::string& function = __builtin_FUNCTION(),
76 int line = __builtin_LINE()) override;
77
80 void OnLogMessage(const std::string& message) override;
81
84 void OnLogMessage(const std::string& message, rtc::LoggingSeverity severity) override;
85
89 static void RegisterListener(const std::shared_ptr<Listener> listener);
90
92 static void UnregisterListener();
93
94private:
95 void SetLogLevel(Level level);
96 Level WebRTCSeverityToLogLevel(rtc::LoggingSeverity severity);
97 bool enable_webrtc_log_ = false;
98 Level level_ = kInfo;
99 inline static std::mutex listener_mtx_;
100 inline static std::shared_ptr<Listener> listener_ = nullptr;
101};
102
103} // namespace global
104} // namespace skyway
105
106#endif /* SKYWAY_GLOBAL_LOGGER_HPP */
Logger のリスナー
Definition logger.hpp:24
virtual void OnLog(Level level, const std::string &text)=0
SkyWayのログが出力されたときのイベント
SkyWayのログを出力するクラス
Definition logger.hpp:18
static void UnregisterListener()
登録済みのロガーのリスナーを消去します。
void Log(Level level, const std::string &message, const std::string &filename="", const std::string &function="", int line=-1)
ログを出力します。
Logger(Level level=kInfo, bool enable_webrtc_log=false)
内部向けコンストラクタ
void OnLogMessage(const std::string &message) override
WebRTCのログが出力されたときのイベント
void Warn(const std::string &message, const std::string &filename=__builtin_FILE(), const std::string &function=__builtin_FUNCTION(), int line=__builtin_LINE()) override
Warnレベルのログを出力します。
static void RegisterListener(const std::shared_ptr< Listener > listener)
ロガーのリスナーを登録します。
void Trace(const std::string &message, const std::string &filename=__builtin_FILE(), const std::string &function=__builtin_FUNCTION(), int line=__builtin_LINE()) override
Traceレベルのログを出力します。
void Info(const std::string &message, const std::string &filename=__builtin_FILE(), const std::string &function=__builtin_FUNCTION(), int line=__builtin_LINE()) override
Infoレベルのログを出力します。
void Debug(const std::string &message, const std::string &filename=__builtin_FILE(), const std::string &function=__builtin_FUNCTION(), int line=__builtin_LINE()) override
Debugレベルのログを出力します。
void OnLogMessage(const std::string &message, rtc::LoggingSeverity severity) override
WebRTCのログが出力されたときのイベント
void Error(const std::string &message, const std::string &filename=__builtin_FILE(), const std::string &function=__builtin_FUNCTION(), int line=__builtin_LINE()) override
Errorレベルのログを出力します。
SkyWayのログを処理するクラス
Definition logger.hpp:59
Level
ログレベル
Definition logger.hpp:62