提交 a393689e authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

worker Logger: add logLevel "none" and replace MS_DUMP() macro with MS_DEBUG_DEV() (fixes #253)

上级 5aa09304
......@@ -5,9 +5,10 @@
enum class LogLevel : uint8_t
{
LOG_DEBUG = 2,
LOG_WARN = 1,
LOG_ERROR = 0
LOG_DEBUG = 3,
LOG_WARN = 2,
LOG_ERROR = 1,
LOG_NONE = 0
};
#endif
......@@ -3,10 +3,13 @@
*
* This include file defines logging macros for source files (.cpp). Each
* source file including Logger.hpp MUST define its own MS_CLASS macro. Include
* files (.h) MUST NOT include Logger.hpp.
* files (.hpp) MUST NOT include Logger.hpp.
*
* All the logging macros use the same format as printf(). The XXX_STD version
* All the logging macros use the same format as printf(). The XXX_STD() version
* of a macro logs to stdoud/stderr instead of using the Channel instance.
* However some macros such as MS_ABORT() and MS_ASSERT() always log to stderr.
*
* If the macro MS_LOG_STD is defined, all the macros log to stdout/stderr.
*
* If the macro MS_LOG_FILE_LINE is defied, all the logging macros print more
* verbose information, including current file and line.
......@@ -41,18 +44,15 @@
* MS_DEBUG_DEV(...)
* MS_WARN_DEV(...)
*
* Logs if the current source file defines the MS_LOG_DEV macro.
* Logs if the current source file defines the MS_LOG_DEV macro and the current
* debug level is satisfied.
* Example:
* MS_DEBUG_DEV("Producer closed [producerId:%" PRIu32 "]", producerId);
*
* MS_DUMP(...)
*
* For Dump() methods.
*
* MS_ERROR(...)
*
* Logs an error. Must just be used for internal errors that should not
* happen.
* Logs an error if the current debug level is satisfied. Must just be used for
* internal errors that should not happen.
*
* MS_ABORT(...)
*
......@@ -138,7 +138,7 @@ public:
#define MS_TRACE() \
do \
{ \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel) \
if (Settings::configuration.logLevel == LogLevel::LOG_DEBUG) \
{ \
int loggerWritten = std::snprintf(Logger::buffer, Logger::bufferSize, "D(trace) " _MS_LOG_STR, _MS_LOG_ARG); \
Logger::channel->SendLog(Logger::buffer, loggerWritten); \
......@@ -149,7 +149,7 @@ public:
#define MS_TRACE_STD() \
do \
{ \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel) \
if (Settings::configuration.logLevel == LogLevel::LOG_DEBUG) \
{ \
std::fprintf(stdout, "(trace) " _MS_LOG_STR _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG); \
std::fflush(stdout); \
......@@ -162,15 +162,15 @@ public:
#endif
#define MS_HAS_DEBUG_TAG(tag) \
(LogLevel::LOG_DEBUG == Settings::configuration.logLevel && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED))
(Settings::configuration.logLevel == LogLevel::LOG_DEBUG && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED))
#define MS_HAS_WARN_TAG(tag) \
(LogLevel::LOG_WARN <= Settings::configuration.logLevel && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED))
(Settings::configuration.logLevel >= LogLevel::LOG_WARN && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED))
#define MS_DEBUG_TAG(tag, desc, ...) \
do \
{ \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED)) \
if (Settings::configuration.logLevel == LogLevel::LOG_DEBUG && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED)) \
{ \
int loggerWritten = std::snprintf(Logger::buffer, Logger::bufferSize, "D" _MS_LOG_STR_DESC desc, _MS_LOG_ARG, ##__VA_ARGS__); \
Logger::channel->SendLog(Logger::buffer, loggerWritten); \
......@@ -181,7 +181,7 @@ public:
#define MS_DEBUG_TAG_STD(tag, desc, ...) \
do \
{ \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED)) \
if (Settings::configuration.logLevel == LogLevel::LOG_DEBUG && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED)) \
{ \
std::fprintf(stdout, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stdout); \
......@@ -192,7 +192,7 @@ public:
#define MS_WARN_TAG(tag, desc, ...) \
do \
{ \
if (LogLevel::LOG_WARN <= Settings::configuration.logLevel && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED)) \
if (Settings::configuration.logLevel >= LogLevel::LOG_WARN && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED)) \
{ \
int loggerWritten = std::snprintf(Logger::buffer, Logger::bufferSize, "W" _MS_LOG_STR_DESC desc, _MS_LOG_ARG, ##__VA_ARGS__); \
Logger::channel->SendLog(Logger::buffer, loggerWritten); \
......@@ -203,7 +203,7 @@ public:
#define MS_WARN_TAG_STD(tag, desc, ...) \
do \
{ \
if (LogLevel::LOG_WARN <= Settings::configuration.logLevel && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED)) \
if (Settings::configuration.logLevel >= LogLevel::LOG_WARN && (_MS_TAG_ENABLED(tag) || _MS_LOG_DEV_ENABLED)) \
{ \
std::fprintf(stderr, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stderr); \
......@@ -214,7 +214,7 @@ public:
#define MS_DEBUG_2TAGS(tag1, tag2, desc, ...) \
do \
{ \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel && (_MS_TAG_ENABLED_2(tag1, tag2) || _MS_LOG_DEV_ENABLED)) \
if (Settings::configuration.logLevel == LogLevel::LOG_DEBUG && (_MS_TAG_ENABLED_2(tag1, tag2) || _MS_LOG_DEV_ENABLED)) \
{ \
int loggerWritten = std::snprintf(Logger::buffer, Logger::bufferSize, "D" _MS_LOG_STR_DESC desc, _MS_LOG_ARG, ##__VA_ARGS__); \
Logger::channel->SendLog(Logger::buffer, loggerWritten); \
......@@ -225,7 +225,7 @@ public:
#define MS_DEBUG_2TAGS_STD(tag1, tag2, desc, ...) \
do \
{ \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel && (_MS_TAG_ENABLED_2(tag1, tag2) || _MS_LOG_DEV_ENABLED)) \
if (Settings::configuration.logLevel == LogLevel::LOG_DEBUG && (_MS_TAG_ENABLED_2(tag1, tag2) || _MS_LOG_DEV_ENABLED)) \
{ \
std::fprintf(stdout, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stdout); \
......@@ -236,7 +236,7 @@ public:
#define MS_WARN_2TAGS(tag1, tag2, desc, ...) \
do \
{ \
if (LogLevel::LOG_WARN <= Settings::configuration.logLevel && (_MS_TAG_ENABLED_2(tag1, tag2) || _MS_LOG_DEV_ENABLED)) \
if (Settings::configuration.logLevel >= LogLevel::LOG_WARN && (_MS_TAG_ENABLED_2(tag1, tag2) || _MS_LOG_DEV_ENABLED)) \
{ \
int loggerWritten = std::snprintf(Logger::buffer, Logger::bufferSize, "W" _MS_LOG_STR_DESC desc, _MS_LOG_ARG, ##__VA_ARGS__); \
Logger::channel->SendLog(Logger::buffer, loggerWritten); \
......@@ -247,7 +247,7 @@ public:
#define MS_WARN_2TAGS_STD(tag1, tag2, desc, ...) \
do \
{ \
if (LogLevel::LOG_WARN <= Settings::configuration.logLevel && (_MS_TAG_ENABLED_2(tag1, tag2) || _MS_LOG_DEV_ENABLED)) \
if (Settings::configuration.logLevel >= LogLevel::LOG_WARN && (_MS_TAG_ENABLED_2(tag1, tag2) || _MS_LOG_DEV_ENABLED)) \
{ \
std::fprintf(stderr, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stderr); \
......@@ -259,7 +259,7 @@ public:
#define MS_DEBUG_DEV(desc, ...) \
do \
{ \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel) \
if (Settings::configuration.logLevel == LogLevel::LOG_DEBUG) \
{ \
int loggerWritten = std::snprintf(Logger::buffer, Logger::bufferSize, "D" _MS_LOG_STR_DESC desc, _MS_LOG_ARG, ##__VA_ARGS__); \
Logger::channel->SendLog(Logger::buffer, loggerWritten); \
......@@ -270,7 +270,7 @@ public:
#define MS_DEBUG_DEV_STD(desc, ...) \
do \
{ \
if (LogLevel::LOG_DEBUG == Settings::configuration.logLevel) \
if (Settings::configuration.logLevel == LogLevel::LOG_DEBUG) \
{ \
std::fprintf(stdout, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stdout); \
......@@ -281,7 +281,7 @@ public:
#define MS_WARN_DEV(desc, ...) \
do \
{ \
if (LogLevel::LOG_WARN <= Settings::configuration.logLevel) \
if (Settings::configuration.logLevel >= LogLevel::LOG_WARN) \
{ \
int loggerWritten = std::snprintf(Logger::buffer, Logger::bufferSize, "W" _MS_LOG_STR_DESC desc, _MS_LOG_ARG, ##__VA_ARGS__); \
Logger::channel->SendLog(Logger::buffer, loggerWritten); \
......@@ -292,7 +292,7 @@ public:
#define MS_WARN_DEV_STD(desc, ...) \
do \
{ \
if (LogLevel::LOG_WARN <= Settings::configuration.logLevel) \
if (Settings::configuration.logLevel >= LogLevel::LOG_WARN) \
{ \
std::fprintf(stderr, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stderr); \
......@@ -306,35 +306,25 @@ public:
#define MS_WARN_DEV_STD(desc, ...) ;
#endif
#define MS_DUMP(desc, ...) \
do \
{ \
int loggerWritten = std::snprintf(Logger::buffer, Logger::bufferSize, "D" _MS_LOG_STR_DESC desc, _MS_LOG_ARG, ##__VA_ARGS__); \
Logger::channel->SendLog(Logger::buffer, loggerWritten); \
} \
while (false)
#define MS_DUMP_STD(desc, ...) \
do \
{ \
std::fprintf(stdout, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stdout); \
} \
while (false)
#define MS_ERROR(desc, ...) \
do \
{ \
int loggerWritten = std::snprintf(Logger::buffer, Logger::bufferSize, "E" _MS_LOG_STR_DESC desc, _MS_LOG_ARG, ##__VA_ARGS__); \
Logger::channel->SendLog(Logger::buffer, loggerWritten); \
if (Settings::configuration.logLevel >= LogLevel::LOG_ERROR) \
{ \
int loggerWritten = std::snprintf(Logger::buffer, Logger::bufferSize, "E" _MS_LOG_STR_DESC desc, _MS_LOG_ARG, ##__VA_ARGS__); \
Logger::channel->SendLog(Logger::buffer, loggerWritten); \
} \
} \
while (false)
#define MS_ERROR_STD(desc, ...) \
do \
{ \
std::fprintf(stderr, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stderr); \
if (Settings::configuration.logLevel >= LogLevel::LOG_ERROR) \
{ \
std::fprintf(stderr, _MS_LOG_STR_DESC desc _MS_LOG_SEPARATOR_CHAR_STD, _MS_LOG_ARG, ##__VA_ARGS__); \
std::fflush(stderr); \
} \
} \
while (false)
......@@ -368,8 +358,6 @@ public:
#define MS_DEBUG_DEV MS_DEBUG_DEV_STD
#undef MS_WARN_DEV
#define MS_WARN_DEV MS_WARN_DEV_STD
#undef MS_DUMP
#define MS_DUMP MS_DUMP_STD
#undef MS_ERROR
#define MS_ERROR MS_ERROR_STD
#endif
......
......@@ -85,9 +85,9 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<PayloadDescriptor>");
MS_DUMP(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false");
MS_DUMP("</PayloadDescriptor>");
MS_DEBUG_DEV("<PayloadDescriptor>");
MS_DEBUG_DEV(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false");
MS_DEBUG_DEV("</PayloadDescriptor>");
}
H264::PayloadDescriptorHandler::PayloadDescriptorHandler(H264::PayloadDescriptor* payloadDescriptor)
......
......@@ -146,29 +146,29 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<PayloadDescriptor>");
MS_DUMP(" extended : %" PRIu8, this->extended);
MS_DUMP(" nonReference : %" PRIu8, this->nonReference);
MS_DUMP(" start : %" PRIu8, this->start);
MS_DUMP(" partitionIndex : %" PRIu8, this->partitionIndex);
MS_DUMP(
MS_DEBUG_DEV("<PayloadDescriptor>");
MS_DEBUG_DEV(" extended : %" PRIu8, this->extended);
MS_DEBUG_DEV(" nonReference : %" PRIu8, this->nonReference);
MS_DEBUG_DEV(" start : %" PRIu8, this->start);
MS_DEBUG_DEV(" partitionIndex : %" PRIu8, this->partitionIndex);
MS_DEBUG_DEV(
" i|l|t|k : %" PRIu8 "|%" PRIu8 "|%" PRIu8 "|%" PRIu8,
this->i,
this->l,
this->t,
this->k);
MS_DUMP(" pictureId : %" PRIu16, this->pictureId);
MS_DUMP(" tl0PictureIndex : %" PRIu8, this->tl0PictureIndex);
MS_DUMP(" tlIndex : %" PRIu8, this->tlIndex);
MS_DUMP(" y : %" PRIu8, this->y);
MS_DUMP(" keyIndex : %" PRIu8, this->keyIndex);
MS_DUMP(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false");
MS_DUMP(" hasPictureId : %s", this->hasPictureId ? "true" : "false");
MS_DUMP(" hasOneBytePictureId : %s", this->hasOneBytePictureId ? "true" : "false");
MS_DUMP(" hasTwoBytesPictureId : %s", this->hasTwoBytesPictureId ? "true" : "false");
MS_DUMP(" hasTl0PictureIndex : %s", this->hasTl0PictureIndex ? "true" : "false");
MS_DUMP(" hasTlIndex : %s", this->hasTlIndex ? "true" : "false");
MS_DUMP("</PayloadDescriptor>");
MS_DEBUG_DEV(" pictureId : %" PRIu16, this->pictureId);
MS_DEBUG_DEV(" tl0PictureIndex : %" PRIu8, this->tl0PictureIndex);
MS_DEBUG_DEV(" tlIndex : %" PRIu8, this->tlIndex);
MS_DEBUG_DEV(" y : %" PRIu8, this->y);
MS_DEBUG_DEV(" keyIndex : %" PRIu8, this->keyIndex);
MS_DEBUG_DEV(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false");
MS_DEBUG_DEV(" hasPictureId : %s", this->hasPictureId ? "true" : "false");
MS_DEBUG_DEV(" hasOneBytePictureId : %s", this->hasOneBytePictureId ? "true" : "false");
MS_DEBUG_DEV(" hasTwoBytesPictureId : %s", this->hasTwoBytesPictureId ? "true" : "false");
MS_DEBUG_DEV(" hasTl0PictureIndex : %s", this->hasTl0PictureIndex ? "true" : "false");
MS_DEBUG_DEV(" hasTlIndex : %s", this->hasTlIndex ? "true" : "false");
MS_DEBUG_DEV("</PayloadDescriptor>");
}
VP8::PayloadDescriptorHandler::PayloadDescriptorHandler(VP8::PayloadDescriptor* payloadDescriptor)
......
......@@ -609,15 +609,15 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<DtlsTransport>");
MS_DUMP(
MS_DEBUG_DEV("<DtlsTransport>");
MS_DEBUG_DEV(
" [role:%s, running:%s, handshake done:%s, connected:%s]",
(this->localRole == Role::SERVER ? "server"
: (this->localRole == Role::CLIENT ? "client" : "none")),
IsRunning() ? "yes" : "no",
this->handshakeDone ? "yes" : "no",
this->state == DtlsState::CONNECTED ? "yes" : "no");
MS_DUMP("</DtlsTransport>");
MS_DEBUG_DEV("</DtlsTransport>");
}
void DtlsTransport::Run(Role localRole)
......
......@@ -90,14 +90,14 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<ByePacket>");
MS_DEBUG_DEV("<ByePacket>");
for (auto ssrc : this->ssrcs)
{
MS_DUMP(" ssrc : %" PRIu32, ssrc);
MS_DEBUG_DEV(" ssrc : %" PRIu32, ssrc);
}
if (!this->reason.empty())
MS_DUMP(" reason : %s", this->reason.c_str());
MS_DUMP("</ByePacket>");
MS_DEBUG_DEV(" reason : %s", this->reason.c_str());
MS_DEBUG_DEV("</ByePacket>");
}
} // namespace RTCP
} // namespace RTC
......@@ -85,7 +85,7 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<CompoundPacket>");
MS_DEBUG_DEV("<CompoundPacket>");
if (HasSenderReport())
{
......@@ -100,7 +100,7 @@ namespace RTC
if (this->sdesPacket.GetCount() != 0u)
this->sdesPacket.Dump();
MS_DUMP("</CompoundPacket>");
MS_DEBUG_DEV("</CompoundPacket>");
}
void CompoundPacket::AddSenderReport(SenderReport* report)
......
......@@ -86,9 +86,9 @@ namespace RTC
{
MS_TRACE();
MS_DUMP(" sender ssrc : %" PRIu32, GetSenderSsrc());
MS_DUMP(" media ssrc : %" PRIu32, GetMediaSsrc());
MS_DUMP(" size : %zu", this->GetSize());
MS_DEBUG_DEV(" sender ssrc : %" PRIu32, GetSenderSsrc());
MS_DEBUG_DEV(" media ssrc : %" PRIu32, GetMediaSsrc());
MS_DEBUG_DEV(" size : %zu", this->GetSize());
}
/* Specialization for Ps class. */
......
......@@ -82,13 +82,13 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<%s>", FeedbackPsPacket::MessageType2String(Item::messageType).c_str());
MS_DEBUG_DEV("<%s>", FeedbackPsPacket::MessageType2String(Item::messageType).c_str());
FeedbackPsPacket::Dump();
for (auto item : this->items)
{
item->Dump();
}
MS_DUMP("</%s>", FeedbackPsPacket::MessageType2String(Item::messageType).c_str());
MS_DEBUG_DEV("</%s>", FeedbackPsPacket::MessageType2String(Item::messageType).c_str());
}
// explicit instantiation to have all FeedbackRtpPacket definitions in this file.
......
......@@ -61,9 +61,9 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackPsAfbPacket>");
MS_DEBUG_DEV("<FeedbackPsAfbPacket>");
FeedbackPsPacket::Dump();
MS_DUMP("</FeedbackPsAfbPacket>");
MS_DEBUG_DEV("</FeedbackPsAfbPacket>");
}
} // namespace RTCP
} // namespace RTC
......@@ -41,10 +41,10 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackPsFirItem>");
MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
MS_DUMP(" sequence number : %" PRIu8, this->GetSequenceNumber());
MS_DUMP("</FeedbackPsFirItem>");
MS_DEBUG_DEV("<FeedbackPsFirItem>");
MS_DEBUG_DEV(" ssrc : %" PRIu32, this->GetSsrc());
MS_DEBUG_DEV(" sequence number : %" PRIu8, this->GetSequenceNumber());
MS_DEBUG_DEV("</FeedbackPsFirItem>");
}
} // namespace RTCP
} // namespace RTC
......@@ -33,9 +33,9 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackPsLeiItem>");
MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
MS_DUMP("</FeedbackPsLeiItem>");
MS_DEBUG_DEV("<FeedbackPsLeiItem>");
MS_DEBUG_DEV(" ssrc : %" PRIu32, this->GetSsrc());
MS_DEBUG_DEV("</FeedbackPsLeiItem>");
}
} // namespace RTCP
} // namespace RTC
......@@ -32,9 +32,9 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackPsPliPacket>");
MS_DEBUG_DEV("<FeedbackPsPliPacket>");
FeedbackPsPacket::Dump();
MS_DUMP("</FeedbackPsPliPacket>");
MS_DEBUG_DEV("</FeedbackPsPliPacket>");
}
} // namespace RTCP
} // namespace RTC
......@@ -132,14 +132,14 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackPsRembPacket>");
MS_DEBUG_DEV("<FeedbackPsRembPacket>");
FeedbackPsPacket::Dump();
MS_DUMP(" bitrate (bps): %" PRIu64, this->bitrate);
MS_DEBUG_DEV(" bitrate (bps): %" PRIu64, this->bitrate);
for (auto ssrc : this->ssrcs)
{
MS_DUMP(" ssrc: %" PRIu32, ssrc);
MS_DEBUG_DEV(" ssrc: %" PRIu32, ssrc);
}
MS_DUMP("</FeedbackPsRembPacket>");
MS_DEBUG_DEV("</FeedbackPsRembPacket>");
}
} // namespace RTCP
} // namespace RTC
......@@ -76,11 +76,11 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackPsRpsiItem>");
MS_DUMP(" padding bits : %" PRIu8, this->header->paddingBits);
MS_DUMP(" payload type : %" PRIu8, this->GetPayloadType());
MS_DUMP(" length : %zu", this->GetLength());
MS_DUMP("</FeedbackPsRpsiItem>");
MS_DEBUG_DEV("<FeedbackPsRpsiItem>");
MS_DEBUG_DEV(" padding bits : %" PRIu8, this->header->paddingBits);
MS_DEBUG_DEV(" payload type : %" PRIu8, this->GetPayloadType());
MS_DEBUG_DEV(" length : %zu", this->GetLength());
MS_DEBUG_DEV("</FeedbackPsRpsiItem>");
}
} // namespace RTCP
} // namespace RTC
......@@ -39,11 +39,11 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackPsSliItem>");
MS_DUMP(" first : %" PRIu16, this->first);
MS_DUMP(" number : %" PRIu16, this->number);
MS_DUMP(" picture id : %" PRIu8, this->pictureId);
MS_DUMP("</FeedbackPsSliItem>");
MS_DEBUG_DEV("<FeedbackPsSliItem>");
MS_DEBUG_DEV(" first : %" PRIu16, this->first);
MS_DEBUG_DEV(" number : %" PRIu16, this->number);
MS_DEBUG_DEV(" picture id : %" PRIu8, this->pictureId);
MS_DEBUG_DEV("</FeedbackPsSliItem>");
}
} // namespace RTCP
} // namespace RTC
......@@ -40,11 +40,11 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackPsTstItem>");
MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
MS_DUMP(" sequence number : %" PRIu32, this->GetSequenceNumber());
MS_DUMP(" index : %" PRIu32, this->GetIndex());
MS_DUMP("</FeedbackPsTstItem>");
MS_DEBUG_DEV("<FeedbackPsTstItem>");
MS_DEBUG_DEV(" ssrc : %" PRIu32, this->GetSsrc());
MS_DEBUG_DEV(" sequence number : %" PRIu32, this->GetSequenceNumber());
MS_DEBUG_DEV(" index : %" PRIu32, this->GetIndex());
MS_DEBUG_DEV("</FeedbackPsTstItem>");
}
/* Specialization for Tstr class. */
......
......@@ -50,12 +50,12 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackPsVbcmItem>");
MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
MS_DUMP(" sequence number : %" PRIu8, this->GetSequenceNumber());
MS_DUMP(" payload type : %" PRIu8, this->GetPayloadType());
MS_DUMP(" length : %" PRIu16, this->GetLength());
MS_DUMP("</FeedbackPsVbcmItem>");
MS_DEBUG_DEV("<FeedbackPsVbcmItem>");
MS_DEBUG_DEV(" ssrc : %" PRIu32, this->GetSsrc());
MS_DEBUG_DEV(" sequence number : %" PRIu8, this->GetSequenceNumber());
MS_DEBUG_DEV(" payload type : %" PRIu8, this->GetPayloadType());
MS_DEBUG_DEV(" length : %" PRIu16, this->GetLength());
MS_DEBUG_DEV("</FeedbackPsVbcmItem>");
}
} // namespace RTCP
} // namespace RTC
......@@ -73,13 +73,13 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<%s>", FeedbackRtpPacket::MessageType2String(Item::messageType).c_str());
MS_DEBUG_DEV("<%s>", FeedbackRtpPacket::MessageType2String(Item::messageType).c_str());
FeedbackRtpPacket::Dump();
for (auto item : this->items)
{
item->Dump();
}
MS_DUMP("</%s>", FeedbackRtpPacket::MessageType2String(Item::messageType).c_str());
MS_DEBUG_DEV("</%s>", FeedbackRtpPacket::MessageType2String(Item::messageType).c_str());
}
// Explicit instantiation to have all FeedbackRtpPacket definitions in this file.
......
......@@ -23,15 +23,15 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackRtpEcnItem>");
MS_DUMP(" sequence number : %" PRIu32, this->GetSequenceNumber());
MS_DUMP(" ect0 counter : %" PRIu32, this->GetEct0Counter());
MS_DUMP(" ect1 counter : %" PRIu32, this->GetEct1Counter());
MS_DUMP(" ecn ce counter : %" PRIu16, this->GetEcnCeCounter());
MS_DUMP(" not ect counter : %" PRIu16, this->GetNotEctCounter());
MS_DUMP(" lost packets : %" PRIu16, this->GetLostPackets());
MS_DUMP(" duplicated packets : %" PRIu16, this->GetDuplicatedPackets());
MS_DUMP("</FeedbackRtpEcnItem>");
MS_DEBUG_DEV("<FeedbackRtpEcnItem>");
MS_DEBUG_DEV(" sequence number : %" PRIu32, this->GetSequenceNumber());
MS_DEBUG_DEV(" ect0 counter : %" PRIu32, this->GetEct0Counter());
MS_DEBUG_DEV(" ect1 counter : %" PRIu32, this->GetEct1Counter());
MS_DEBUG_DEV(" ecn ce counter : %" PRIu16, this->GetEcnCeCounter());
MS_DEBUG_DEV(" not ect counter : %" PRIu16, this->GetNotEctCounter());
MS_DEBUG_DEV(" lost packets : %" PRIu16, this->GetLostPackets());
MS_DEBUG_DEV(" duplicated packets : %" PRIu16, this->GetDuplicatedPackets());
MS_DEBUG_DEV("</FeedbackRtpEcnItem>");
}
} // namespace RTCP
} // namespace RTC
......@@ -36,10 +36,10 @@ namespace RTC
std::bitset<16> nackBitset(this->GetLostPacketBitmask());
MS_DUMP("<FeedbackRtpNackItem>");
MS_DUMP(" pid : %" PRIu16, this->GetPacketId());
MS_DUMP(" bpl : %s", nackBitset.to_string().c_str());
MS_DUMP("</FeedbackRtpNackItem>");
MS_DEBUG_DEV("<FeedbackRtpNackItem>");
MS_DEBUG_DEV(" pid : %" PRIu16, this->GetPacketId());
MS_DEBUG_DEV(" bpl : %s", nackBitset.to_string().c_str());
MS_DEBUG_DEV("</FeedbackRtpNackItem>");
}
} // namespace RTCP
} // namespace RTC
......@@ -30,9 +30,9 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackRtpSrReqPacket>");
MS_DEBUG_DEV("<FeedbackRtpSrReqPacket>");
FeedbackRtpPacket::Dump();
MS_DUMP("</FeedbackRtpSrReqPacket>");
MS_DEBUG_DEV("</FeedbackRtpSrReqPacket>");
}
} // namespace RTCP
} // namespace RTC
......@@ -33,10 +33,10 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackRtpTlleiItem>");
MS_DUMP(" pid: %" PRIu16, this->GetPacketId());
MS_DUMP(" bpl: %" PRIu16, this->GetLostPacketBitmask());
MS_DUMP("</FeedbackRtpTlleiItem>");
MS_DEBUG_DEV("<FeedbackRtpTlleiItem>");
MS_DEBUG_DEV(" pid: %" PRIu16, this->GetPacketId());
MS_DEBUG_DEV(" bpl: %" PRIu16, this->GetLostPacketBitmask());
MS_DEBUG_DEV("</FeedbackRtpTlleiItem>");
}
} // namespace RTCP
} // namespace RTC
......@@ -68,11 +68,11 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<FeedbackRtpTmmbItem>");
MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
MS_DUMP(" bitrate : %" PRIu64, this->GetBitrate());
MS_DUMP(" overhead : %" PRIu16, this->GetOverhead());
MS_DUMP("</FeedbackRtpTmmbItem>");
MS_DEBUG_DEV("<FeedbackRtpTmmbItem>");
MS_DEBUG_DEV(" ssrc : %" PRIu32, this->GetSsrc());
MS_DEBUG_DEV(" bitrate : %" PRIu64, this->GetBitrate());
MS_DEBUG_DEV(" overhead : %" PRIu16, this->GetOverhead());
MS_DEBUG_DEV("</FeedbackRtpTmmbItem>");
}
/* Specialization for Tmmbr class. */
......
......@@ -36,15 +36,15 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<ReceiverReport>");
MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
MS_DUMP(" fraction lost : %" PRIu32, this->GetFractionLost());
MS_DUMP(" total lost : %" PRIu32, this->GetTotalLost());
MS_DUMP(" last seq : %" PRIu32, this->GetLastSeq());
MS_DUMP(" jitter : %" PRIu32, this->GetJitter());
MS_DUMP(" lsr : %" PRIu32, this->GetLastSenderReport());
MS_DUMP(" dlsr : %" PRIu32, this->GetDelaySinceLastSenderReport());
MS_DUMP("</ReceiverReport>");
MS_DEBUG_DEV("<ReceiverReport>");
MS_DEBUG_DEV(" ssrc : %" PRIu32, this->GetSsrc());
MS_DEBUG_DEV(" fraction lost : %" PRIu32, this->GetFractionLost());
MS_DEBUG_DEV(" total lost : %" PRIu32, this->GetTotalLost());
MS_DEBUG_DEV(" last seq : %" PRIu32, this->GetLastSeq());
MS_DEBUG_DEV(" jitter : %" PRIu32, this->GetJitter());
MS_DEBUG_DEV(" lsr : %" PRIu32, this->GetLastSenderReport());
MS_DEBUG_DEV(" dlsr : %" PRIu32, this->GetDelaySinceLastSenderReport());
MS_DEBUG_DEV("</ReceiverReport>");
}
size_t ReceiverReport::Serialize(uint8_t* buffer)
......@@ -133,13 +133,13 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<ReceiverReportPacket>");
MS_DUMP(" ssrc: %" PRIu32, static_cast<uint32_t>(ntohl(this->ssrc)));
MS_DEBUG_DEV("<ReceiverReportPacket>");
MS_DEBUG_DEV(" ssrc: %" PRIu32, static_cast<uint32_t>(ntohl(this->ssrc)));
for (auto report : this->reports)
{
report->Dump();
}
MS_DUMP("</ReceiverReportPacket>");
MS_DEBUG_DEV("</ReceiverReportPacket>");
}
} // namespace RTCP
} // namespace RTC
......@@ -85,11 +85,11 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<SdesItem>");
MS_DUMP(" type : %s", SdesItem::Type2String(this->GetType()).c_str());
MS_DUMP(" length : %" PRIu8, this->header->length);
MS_DUMP(" value : %.*s", this->header->length, this->header->value);
MS_DUMP("</SdesItem>");
MS_DEBUG_DEV("<SdesItem>");
MS_DEBUG_DEV(" type : %s", SdesItem::Type2String(this->GetType()).c_str());
MS_DEBUG_DEV(" length : %" PRIu8, this->header->length);
MS_DEBUG_DEV(" value : %.*s", this->header->length, this->header->value);
MS_DEBUG_DEV("</SdesItem>");
}
size_t SdesItem::Serialize(uint8_t* buffer)
......@@ -167,13 +167,13 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<SdesChunk>");
MS_DUMP(" ssrc : %" PRIu32, static_cast<uint32_t>(ntohl(this->ssrc)));
MS_DEBUG_DEV("<SdesChunk>");
MS_DEBUG_DEV(" ssrc : %" PRIu32, static_cast<uint32_t>(ntohl(this->ssrc)));
for (auto item : this->items)
{
item->Dump();
}
MS_DUMP("</SdesChunk>");
MS_DEBUG_DEV("</SdesChunk>");
}
/* Class methods. */
......@@ -226,12 +226,12 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<SdesPacket>");
MS_DEBUG_DEV("<SdesPacket>");
for (auto chunk : this->chunks)
{
chunk->Dump();
}
MS_DUMP("</SdesPacket>");
MS_DEBUG_DEV("</SdesPacket>");
}
} // namespace RTCP
} // namespace RTC
......@@ -35,14 +35,14 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<SenderReport>");
MS_DUMP(" ssrc : %" PRIu32, this->GetSsrc());
MS_DUMP(" ntp sec : %" PRIu32, this->GetNtpSec());
MS_DUMP(" ntp frac : %" PRIu32, this->GetNtpFrac());
MS_DUMP(" rtp ts : %" PRIu32, this->GetRtpTs());
MS_DUMP(" packet count : %" PRIu32, this->GetPacketCount());
MS_DUMP(" octet count : %" PRIu32, this->GetOctetCount());
MS_DUMP("</SenderReport>");
MS_DEBUG_DEV("<SenderReport>");
MS_DEBUG_DEV(" ssrc : %" PRIu32, this->GetSsrc());
MS_DEBUG_DEV(" ntp sec : %" PRIu32, this->GetNtpSec());
MS_DEBUG_DEV(" ntp frac : %" PRIu32, this->GetNtpFrac());
MS_DEBUG_DEV(" rtp ts : %" PRIu32, this->GetRtpTs());
MS_DEBUG_DEV(" packet count : %" PRIu32, this->GetPacketCount());
MS_DEBUG_DEV(" octet count : %" PRIu32, this->GetOctetCount());
MS_DEBUG_DEV("</SenderReport>");
}
size_t SenderReport::Serialize(uint8_t* buffer)
......@@ -97,12 +97,12 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<SenderReportPacket>");
MS_DEBUG_DEV("<SenderReportPacket>");
for (auto report : this->reports)
{
report->Dump();
}
MS_DUMP("</SenderReportPacket>");
MS_DEBUG_DEV("</SenderReportPacket>");
}
} // namespace RTCP
} // namespace RTC
......@@ -139,12 +139,12 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<RtpMonitor>");
MS_DUMP(" score : %" PRIi8, GetScore());
MS_DUMP(" totalSourceLoss : %" PRIi32, this->totalSourceLoss);
MS_DUMP(" totalReportedLoss : %" PRIi32, this->totalReportedLoss);
MS_DUMP(" repairedPackets size : %zu", this->repairedPackets.size());
MS_DUMP("</RtpMonitor>");
MS_DEBUG_DEV("<RtpMonitor>");
MS_DEBUG_DEV(" score : %" PRIi8, GetScore());
MS_DEBUG_DEV(" totalSourceLoss : %" PRIi32, this->totalSourceLoss);
MS_DEBUG_DEV(" totalReportedLoss : %" PRIi32, this->totalReportedLoss);
MS_DEBUG_DEV(" repairedPackets size : %zu", this->repairedPackets.size());
MS_DEBUG_DEV("</RtpMonitor>");
}
void RtpMonitor::AddScore(uint8_t score)
......
......@@ -207,21 +207,21 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<RtpPacket>");
MS_DUMP(" padding : %s", this->header->padding ? "true" : "false");
MS_DUMP(" extension header : %s", HasExtensionHeader() ? "true" : "false");
MS_DEBUG_DEV("<RtpPacket>");
MS_DEBUG_DEV(" padding : %s", this->header->padding ? "true" : "false");
MS_DEBUG_DEV(" extension header : %s", HasExtensionHeader() ? "true" : "false");
if (HasExtensionHeader())
{
MS_DUMP(" id : %" PRIu16, GetExtensionHeaderId());
MS_DUMP(" length : %zu bytes", GetExtensionHeaderLength());
MS_DEBUG_DEV(" id : %" PRIu16, GetExtensionHeaderId());
MS_DEBUG_DEV(" length : %zu bytes", GetExtensionHeaderLength());
}
if (HasOneByteExtensions())
{
MS_DUMP(" RFC5285 ext style : One-Byte Header");
MS_DEBUG_DEV(" RFC5285 ext style : One-Byte Header");
}
if (HasTwoBytesExtensions())
{
MS_DUMP(" RFC5285 ext style : Two-Bytes Header");
MS_DEBUG_DEV(" RFC5285 ext style : Two-Bytes Header");
}
if (HasOneByteExtensions() || HasTwoBytesExtensions())
{
......@@ -243,21 +243,21 @@ namespace RTC
extIds.begin(), extIds.end() - 1, std::ostream_iterator<std::string>(extIdsStream, ","));
extIdsStream << extIds.back();
MS_DUMP(" RFC5285 ext ids : %s", extIdsStream.str().c_str());
MS_DEBUG_DEV(" RFC5285 ext ids : %s", extIdsStream.str().c_str());
}
MS_DUMP(" csrc count : %" PRIu8, this->header->csrcCount);
MS_DUMP(" marker : %s", HasMarker() ? "true" : "false");
MS_DUMP(" payload type : %" PRIu8, GetPayloadType());
MS_DUMP(" sequence number : %" PRIu16, GetSequenceNumber());
MS_DUMP(" timestamp : %" PRIu32, GetTimestamp());
MS_DUMP(" ssrc : %" PRIu32, GetSsrc());
MS_DUMP(" payload size : %zu bytes", GetPayloadLength());
MS_DEBUG_DEV(" csrc count : %" PRIu8, this->header->csrcCount);
MS_DEBUG_DEV(" marker : %s", HasMarker() ? "true" : "false");
MS_DEBUG_DEV(" payload type : %" PRIu8, GetPayloadType());
MS_DEBUG_DEV(" sequence number : %" PRIu16, GetSequenceNumber());
MS_DEBUG_DEV(" timestamp : %" PRIu32, GetTimestamp());
MS_DEBUG_DEV(" ssrc : %" PRIu32, GetSsrc());
MS_DEBUG_DEV(" payload size : %zu bytes", GetPayloadLength());
if (this->header->padding != 0u)
{
MS_DUMP(" padding size : %" PRIu8 " bytes", this->payloadPadding);
MS_DEBUG_DEV(" padding size : %" PRIu8 " bytes", this->payloadPadding);
}
MS_DUMP(" packet size : %zu bytes", GetSize());
MS_DUMP("</RtpPacket>");
MS_DEBUG_DEV(" packet size : %zu bytes", GetSize());
MS_DEBUG_DEV("</RtpPacket>");
}
void RtpPacket::MangleExtensionHeaderIds(const std::map<uint8_t, uint8_t>& idMapping)
......
......@@ -315,7 +315,7 @@ namespace RTC
{
MS_TRACE();
MS_DUMP("<StunMessage>");
MS_DEBUG_DEV("<StunMessage>");
std::string klass;
switch (this->klass)
......@@ -335,14 +335,15 @@ namespace RTC
}
if (this->method == Method::BINDING)
{
MS_DUMP(" Binding %s", klass.c_str());
MS_DEBUG_DEV(" Binding %s", klass.c_str());
}
else
{
// This prints the unknown method number. Example: TURN Allocate => 0x003.
MS_DUMP(" %s with unknown method %#.3x", klass.c_str(), static_cast<uint16_t>(this->method));
MS_DEBUG_DEV(
" %s with unknown method %#.3x", klass.c_str(), static_cast<uint16_t>(this->method));
}
MS_DUMP(" size: %zu bytes", this->size);
MS_DEBUG_DEV(" size: %zu bytes", this->size);
static char transactionId[25];
......@@ -351,19 +352,19 @@ namespace RTC
// NOTE: n must be 3 because snprintf adds a \0 after printed chars.
std::snprintf(transactionId + (i * 2), 3, "%.2x", this->transactionId[i]);
}
MS_DUMP(" transactionId: %s", transactionId);
MS_DEBUG_DEV(" transactionId: %s", transactionId);
if (this->errorCode != 0u)
MS_DUMP(" errorCode: %" PRIu16, this->errorCode);
MS_DEBUG_DEV(" errorCode: %" PRIu16, this->errorCode);
if (!this->username.empty())
MS_DUMP(" username: %s", this->username.c_str());
MS_DEBUG_DEV(" username: %s", this->username.c_str());
if (this->priority != 0u)
MS_DUMP(" priority: %" PRIu32, this->priority);
MS_DEBUG_DEV(" priority: %" PRIu32, this->priority);
if (this->iceControlling != 0u)
MS_DUMP(" iceControlling: %" PRIu64, this->iceControlling);
MS_DEBUG_DEV(" iceControlling: %" PRIu64, this->iceControlling);
if (this->iceControlled != 0u)
MS_DUMP(" iceControlled: %" PRIu64, this->iceControlled);
MS_DEBUG_DEV(" iceControlled: %" PRIu64, this->iceControlled);
if (this->hasUseCandidate)
MS_DUMP(" useCandidate");
MS_DEBUG_DEV(" useCandidate");
if (this->xorMappedAddress != nullptr)
{
int family;
......@@ -372,7 +373,7 @@ namespace RTC
Utils::IP::GetAddressInfo(this->xorMappedAddress, &family, ip, &port);
MS_DUMP(" xorMappedAddress: %s : %" PRIu16, ip.c_str(), port);
MS_DEBUG_DEV(" xorMappedAddress: %s : %" PRIu16, ip.c_str(), port);
}
if (this->messageIntegrity != nullptr)
{
......@@ -383,12 +384,12 @@ namespace RTC
std::snprintf(messageIntegrity + (i * 2), 3, "%.2x", this->messageIntegrity[i]);
}
MS_DUMP(" messageIntegrity: %s", messageIntegrity);
MS_DEBUG_DEV(" messageIntegrity: %s", messageIntegrity);
}
if (this->hasFingerprint)
MS_DUMP(" fingerprint");
MS_DEBUG_DEV(" fingerprint");
MS_DUMP("</StunMessage>");
MS_DEBUG_DEV("</StunMessage>");
}
StunMessage::Authentication StunMessage::CheckAuthentication(
......
......@@ -56,27 +56,27 @@ namespace RTC
Utils::IP::GetAddressInfo(GetRemoteAddress(), &remoteFamily, remoteIp, &remotePort);
MS_DUMP("<TransportTuple>");
MS_DUMP(
MS_DEBUG_DEV("<TransportTuple>");
MS_DEBUG_DEV(
" [UDP, local:%s :%" PRIu16 ", remote:%s :%" PRIu16 "]",
this->udpSocket->GetLocalIP().c_str(),
this->udpSocket->GetLocalPort(),
remoteIp.c_str(),
remotePort);
MS_DUMP("</TransportTuple>");
MS_DEBUG_DEV("</TransportTuple>");
break;
}
case Protocol::TCP:
{
MS_DUMP("<TransportTuple>");
MS_DUMP(
MS_DEBUG_DEV("<TransportTuple>");
MS_DEBUG_DEV(
" [TCP, local:%s :%" PRIu16 ", remote:%s :%" PRIu16 "]",
this->tcpConnection->GetLocalIP().c_str(),
this->tcpConnection->GetLocalPort(),
this->tcpConnection->GetPeerIP().c_str(),
this->tcpConnection->GetPeerPort());
MS_DUMP("</TransportTuple>");
MS_DEBUG_DEV("</TransportTuple>");
break;
}
}
......
......@@ -27,13 +27,15 @@ std::map<std::string, LogLevel> Settings::string2LogLevel =
{
{ "debug", LogLevel::LOG_DEBUG },
{ "warn", LogLevel::LOG_WARN },
{ "error", LogLevel::LOG_ERROR }
{ "error", LogLevel::LOG_ERROR },
{ "none", LogLevel::LOG_NONE }
};
std::map<LogLevel, std::string> Settings::logLevel2String =
{
{ LogLevel::LOG_DEBUG, "debug" },
{ LogLevel::LOG_WARN, "warn" },
{ LogLevel::LOG_ERROR, "error" }
{ LogLevel::LOG_ERROR, "error" },
{ LogLevel::LOG_NONE, "none" }
};
// clang-format on
......
......@@ -127,15 +127,15 @@ void TcpConnection::Destroy()
void TcpConnection::Dump() const
{
MS_DUMP("<TcpConnection>");
MS_DUMP(
MS_DEBUG_DEV("<TcpConnection>");
MS_DEBUG_DEV(
" [TCP, local:%s :%" PRIu16 ", remote:%s :%" PRIu16 ", status:%s]",
this->localIP.c_str(),
static_cast<uint16_t>(this->localPort),
this->peerIP.c_str(),
static_cast<uint16_t>(this->peerPort),
(!this->isClosing) ? "open" : "closed");
MS_DUMP("</TcpConnection>");
MS_DEBUG_DEV("</TcpConnection>");
}
void TcpConnection::Start()
......
......@@ -157,14 +157,14 @@ void TcpServer::Destroy()
void TcpServer::Dump() const
{
MS_DUMP("<TcpServer>");
MS_DUMP(
MS_DEBUG_DEV("<TcpServer>");
MS_DEBUG_DEV(
" [TCP, local:%s :%" PRIu16 ", status:%s, connections:%zu]",
this->localIP.c_str(),
static_cast<uint16_t>(this->localPort),
(!this->isClosing) ? "open" : "closed",
this->connections.size());
MS_DUMP("</TcpServer>");
MS_DEBUG_DEV("</TcpServer>");
}
bool TcpServer::SetLocalAddress()
......
......@@ -170,13 +170,13 @@ void UdpSocket::Destroy()
void UdpSocket::Dump() const
{
MS_DUMP("<UdpSocket>");
MS_DUMP(
MS_DEBUG_DEV("<UdpSocket>");
MS_DEBUG_DEV(
" [UDP, local:%s :%" PRIu16 ", status:%s]",
this->localIP.c_str(),
static_cast<uint16_t>(this->localPort),
(!this->isClosing) ? "open" : "closed");
MS_DUMP("</UdpSocket>");
MS_DEBUG_DEV("</UdpSocket>");
}
void UdpSocket::Send(const uint8_t* data, size_t len, const struct sockaddr* addr)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论