Skip to content

Commit

Permalink
日志数据传输无效时不报错,返回错误码
Browse files Browse the repository at this point in the history
  • Loading branch information
ccpwcn committed Mar 1, 2022
1 parent e22a4b9 commit 1cc4750
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions LogUtil/CLogImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ CLog::~CLog()

size_t CLog::info(__in_opt const TCHAR *fmt, ...)
{
assert(fmt != NULL && fmt[0] != _T('\0'));
if (fmt == NULL || fmt[0] == _T('\0')) {
return -1;
}

try {
va_list args;
Expand All @@ -96,7 +98,9 @@ size_t CLog::info(__in_opt const TCHAR *fmt, ...)

size_t CLog::error(__in_opt const TCHAR *fmt, ...)
{
assert(fmt != NULL && fmt[0] != _T('\0'));
if (fmt == NULL || fmt[0] == _T('\0')) {
return -1;
}

va_list args;
va_start(args, fmt);
Expand All @@ -112,7 +116,9 @@ size_t CLog::error(__in_opt const TCHAR *fmt, ...)

size_t CLog::debug(__in_opt const TCHAR *fmt, ...)
{
assert(fmt != NULL && fmt[0] != _T('\0'));
if (fmt == NULL || fmt[0] == _T('\0')) {
return -1;
}

va_list args;
va_start(args, fmt);
Expand All @@ -128,7 +134,9 @@ size_t CLog::debug(__in_opt const TCHAR *fmt, ...)

size_t CLog::warning(__in_opt const TCHAR *fmt, ...)
{
assert(fmt != NULL && fmt[0] != _T('\0'));
if (fmt == NULL || fmt[0] == _T('\0')) {
return -1;
}

va_list args;
va_start(args, fmt);
Expand Down Expand Up @@ -195,6 +203,9 @@ DWORD CLog::m_fnWriteThread(LPVOID lpParam)

size_t CLog::parse(LPSYSTEMTIME lpSystemTime, __in LPCTSTR lpszLogTypeFlag, __in_opt const TCHAR *fmt, va_list args)
{
if (fmt == NULL || fmt[0] == _T('\0')) {
return -1;
}
size_t result = 0;

const int TIME_BUF_LEN = 64;
Expand Down
Binary file modified LogUtil/LogUtil.rc
Binary file not shown.
Binary file added LogUtilMan v1.0.1.5.rar
Binary file not shown.

0 comments on commit 1cc4750

Please sign in to comment.