mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 15:15:28 +00:00
Integrate plog
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
||||
[submodule "usrsctp"]
|
||||
path = deps/usrsctp
|
||||
url = https://github.com/sctplab/usrsctp.git
|
||||
[submodule "deps/plog"]
|
||||
path = deps/plog
|
||||
url = https://github.com/SergiusTheBest/plog
|
||||
|
@ -7,7 +7,7 @@ project (libdatachannel
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
|
||||
|
||||
set(LIBDATACHANNEL_SOURCES
|
||||
set(LIBDATACHANNEL_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/candidate.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/certificate.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/channel.cpp
|
||||
@ -62,6 +62,7 @@ set_target_properties(datachannel PROPERTIES
|
||||
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}/src)
|
||||
target_include_directories(datachannel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/deps/plog/include)
|
||||
target_link_libraries(datachannel usrsctp-static LibNice::LibNice)
|
||||
|
||||
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 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}/deps/plog/include)
|
||||
target_link_libraries(datachannel-static usrsctp-static LibNice::LibNice)
|
||||
|
||||
if (USE_GNUTLS)
|
||||
@ -104,5 +106,6 @@ set_target_properties(tests PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
CXX_STANDARD 17)
|
||||
|
||||
target_include_directories(tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/deps/plog/include)
|
||||
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 {
|
||||
enum class LogLevel { none, fatal, error, warning, info, debug, verbose };
|
||||
|
||||
Configuration(const LogLevel logLevel_ = LogLevel::error);
|
||||
|
||||
std::vector<IceServer> iceServers;
|
||||
bool enableIceTcp = false;
|
||||
uint16_t portRangeBegin = 1024;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <plog/Log.h>
|
||||
|
||||
namespace rtc {
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "configuration.hpp"
|
||||
#include <plog/Appenders/ColorConsoleAppender.h>
|
||||
|
||||
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_),
|
||||
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
|
||||
|
@ -29,12 +29,15 @@ using namespace std;
|
||||
template <class T> weak_ptr<T> make_weak_ptr(shared_ptr<T> ptr) { return ptr; }
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// For debug messages
|
||||
// rtc::Configuration config(Configuration::LogLevel::debug)
|
||||
rtc::Configuration config;
|
||||
|
||||
// config.iceServers.emplace_back("stun.l.google.com:19302");
|
||||
// config.enableIceTcp = true;
|
||||
|
||||
// Add TURN Server Example
|
||||
// IceServer turnServer("TURN_SERVER_URL", "PORT_NO", "USERNAME", "PASSWORD",
|
||||
// IceServer turnServer("TURN_SERVER_URL", "PORT_NO", "USERNAME", "PASSWORD",
|
||||
// IceServer::RelayType::TurnTls);
|
||||
// config.iceServers.push_back(turnServer);
|
||||
|
||||
|
Reference in New Issue
Block a user