mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-23 15:48:03 +00:00
Integrate plog
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
|||||||
[submodule "usrsctp"]
|
[submodule "usrsctp"]
|
||||||
path = deps/usrsctp
|
path = deps/usrsctp
|
||||||
url = https://github.com/sctplab/usrsctp.git
|
url = https://github.com/sctplab/usrsctp.git
|
||||||
|
[submodule "deps/plog"]
|
||||||
|
path = deps/plog
|
||||||
|
url = https://github.com/SergiusTheBest/plog
|
||||||
|
@ -62,6 +62,7 @@ set_target_properties(datachannel PROPERTIES
|
|||||||
target_include_directories(datachannel PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
target_include_directories(datachannel PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
target_include_directories(datachannel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/rtc)
|
target_include_directories(datachannel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/rtc)
|
||||||
target_include_directories(datachannel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
target_include_directories(datachannel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
target_include_directories(datachannel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/deps/plog/include)
|
||||||
target_link_libraries(datachannel usrsctp-static LibNice::LibNice)
|
target_link_libraries(datachannel usrsctp-static LibNice::LibNice)
|
||||||
|
|
||||||
add_library(datachannel-static STATIC EXCLUDE_FROM_ALL ${LIBDATACHANNEL_SOURCES})
|
add_library(datachannel-static STATIC EXCLUDE_FROM_ALL ${LIBDATACHANNEL_SOURCES})
|
||||||
@ -72,6 +73,7 @@ set_target_properties(datachannel-static PROPERTIES
|
|||||||
target_include_directories(datachannel-static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
target_include_directories(datachannel-static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
target_include_directories(datachannel-static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/rtc)
|
target_include_directories(datachannel-static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/rtc)
|
||||||
target_include_directories(datachannel-static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
target_include_directories(datachannel-static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
target_include_directories(datachannel-static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/deps/plog/include)
|
||||||
target_link_libraries(datachannel-static usrsctp-static LibNice::LibNice)
|
target_link_libraries(datachannel-static usrsctp-static LibNice::LibNice)
|
||||||
|
|
||||||
if (USE_GNUTLS)
|
if (USE_GNUTLS)
|
||||||
@ -104,5 +106,6 @@ set_target_properties(tests PROPERTIES
|
|||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
CXX_STANDARD 17)
|
CXX_STANDARD 17)
|
||||||
|
|
||||||
|
target_include_directories(tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/deps/plog/include)
|
||||||
target_link_libraries(tests datachannel)
|
target_link_libraries(tests datachannel)
|
||||||
|
|
||||||
|
1
deps/plog
vendored
Submodule
1
deps/plog
vendored
Submodule
Submodule deps/plog added at 2931644689
@ -47,6 +47,10 @@ struct IceServer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Configuration {
|
struct Configuration {
|
||||||
|
enum class LogLevel { none, fatal, error, warning, info, debug, verbose };
|
||||||
|
|
||||||
|
Configuration(const LogLevel logLevel_ = LogLevel::error);
|
||||||
|
|
||||||
std::vector<IceServer> iceServers;
|
std::vector<IceServer> iceServers;
|
||||||
bool enableIceTcp = false;
|
bool enableIceTcp = false;
|
||||||
uint16_t portRangeBegin = 1024;
|
uint16_t portRangeBegin = 1024;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <plog/Log.h>
|
||||||
|
|
||||||
namespace rtc {
|
namespace rtc {
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "configuration.hpp"
|
#include "configuration.hpp"
|
||||||
|
#include <plog/Appenders/ColorConsoleAppender.h>
|
||||||
|
|
||||||
namespace rtc {
|
namespace rtc {
|
||||||
|
|
||||||
@ -43,4 +44,10 @@ IceServer::IceServer(const string &hostname_, const string &service_, string use
|
|||||||
: hostname(hostname_), service(service_), type(Type::Turn), username(username_),
|
: hostname(hostname_), service(service_), type(Type::Turn), username(username_),
|
||||||
password(password_), relayType(relayType_) {}
|
password(password_), relayType(relayType_) {}
|
||||||
|
|
||||||
|
Configuration::Configuration(const LogLevel logLevel_) {
|
||||||
|
static plog::ColorConsoleAppender<plog::TxtFormatter> consoleAppender;
|
||||||
|
plog::init(static_cast<plog::Severity>(logLevel_), &consoleAppender);
|
||||||
|
LOGD << "Logger Initialized";
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace rtc
|
} // namespace rtc
|
||||||
|
@ -29,7 +29,10 @@ using namespace std;
|
|||||||
template <class T> weak_ptr<T> make_weak_ptr(shared_ptr<T> ptr) { return ptr; }
|
template <class T> weak_ptr<T> make_weak_ptr(shared_ptr<T> ptr) { return ptr; }
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
// For debug messages
|
||||||
|
// rtc::Configuration config(Configuration::LogLevel::debug)
|
||||||
rtc::Configuration config;
|
rtc::Configuration config;
|
||||||
|
|
||||||
// config.iceServers.emplace_back("stun.l.google.com:19302");
|
// config.iceServers.emplace_back("stun.l.google.com:19302");
|
||||||
// config.enableIceTcp = true;
|
// config.enableIceTcp = true;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user