91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

易用而又強大的C++跨平臺日志庫,可以輸出日志到控制臺窗口,文件,http服務器

資源截圖

代碼片段和文件信息

#include?“yaolog.h“
#include?
#include?
#include?

#ifdef?_YAO_LOG_WIN32_
????#include?
????#include?
????#include?
????#include?
????#pragma?comment(lib?“Ws2_32.lib“)
????#pragma?comment(lib?“shlwapi.lib“)
????#pragma?comment(lib?“Rpcrt4.lib“)
????#pragma?warning(disable?:?4996)
#else
????#include?
????#include?
????#include?
????#include?
????#include?
????#include?
????#include?
????#include?
????#include?
????#include?
????#include?
#endif


namespace?YaoUtil?{

//?max?size?of?ini?file?in?bytes
const?int?MAX_INI_FILE_SIZE?=?1024*32;

//?default?log?buffer?size?in?bytes
const?size_t?BUF_SIZE?=?1024*4;

//?max?size?of?the?queue?for?post
const?size_t?MAX_QUEUE_SIZE?=?1000;

const?int?THREAD_CYCLE_SPAN_MILLISECOND?=?2000;
const?int?THREAD_EXIT_TIMEOUT_MILLISECOND?=?300;
char?*g_pData?=?NULL;
char?*g_pRealData?=?NULL;
bool?g_bUseNewBuffer?=?false;
std::queue?>?g_textData;
std::queue?>?g_binData;
std::map?g_files;

void?ResetBuffer()
{
????memset(g_pData?0?BUF_SIZE);
????if?(g_bUseNewBuffer)
????{
????????delete?[]?g_pRealData;
????????g_bUseNewBuffer?=?false;
????}
????g_pRealData?=?NULL;
}

LOGOUT_FLAG?ToFlag(const?std::string&?outFlag)
{
????LOGOUT_FLAG?flag_;
????if?(StrUtil::CompareNoCase(outFlag?“file“))?flag_?=?LOGOUT_FLAG_FILE;
????else?if?(StrUtil::CompareNoCase(outFlag?“stdout“))?flag_?=?LOGOUT_FLAG_STDOUT;
????else?if?(StrUtil::CompareNoCase(outFlag?“remote“))?flag_?=?LOGOUT_FLAG_REMOTE;
????else?flag_?=?LOGOUT_FLAG_OUTPUTDEBUGSTRING;
????return?flag_;
}

void?Queue2Vector(std::queue?>&?data_
??????????????????std::vector?>?>&?new_data)
{
????std::string?last_key;
????std::vector?new_value;
????bool?firstElement?=?true;
????while?(!data_.empty())
????{
????????std::string&?key_?=?data_.front().first;
????????std::string&?value_?=?data_.front().second;
????????if?(firstElement)
????????{
????????????last_key?=?key_;
????????????new_value.push_back(value_);
????????????firstElement?=?false;
????????}
????????else
????????{
????????????if?(key_?!=?last_key)
????????????{
????????????????new_data.push_back(make_pair(last_key?new_value));
????????????????last_key?=?key_;
????????????????new_value.clear();
????????????}
????????????new_value.push_back(value_);
????????}
????????data_.pop();
????}
????if?(!last_key.empty())
????{
????????assert(new_value.size()?>?0);
????????new_data.push_back(make_pair(last_key?new_value));
????}
}

TinyMutex::TinyMutex()
{
#ifdef?_YAO_LOG_WIN32_
????InitializeCriticalSection(&m_handle);
#else
????pthread_mutex_init(

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????374??2013-01-24?15:33??test_linux\logconfig.ini
?????文件????????2097??2013-01-24?15:41??test_linux\main.cpp
?????文件?????????419??2013-01-24?15:35??test_windows\logconfig.ini
?????文件????????2164??2013-01-24?15:40??test_windows\main.cpp
?????文件???????53767??2013-01-24?15:40??yaolog.cpp
?????文件???????20476??2013-01-24?15:43??yaolog.h

評論

共有 條評論