add some log info

This commit is contained in:
gwdwyy 2013-07-09 17:48:12 +08:00
parent a90d37dae7
commit 86d8fc3130
2 changed files with 4 additions and 10 deletions

View File

@ -12,7 +12,9 @@ namespace CppJieba
bool Segment::init(const char* const dictFilePath)
{
LogInfo(string_format("_trie.init(%s) start...", dictFilePath));
_trie.init(dictFilePath);
LogInfo("_trie.init end.");
}
bool Segment::destroy()
@ -69,8 +71,7 @@ namespace CppJieba
if(uniStr.empty())
{
sprintf(logBuf, "utf8ToUnicode [%s] failed!", utfStr.c_str());
LogError(logBuf);
LogError(string_format("utf8ToUnicode [%s] failed!", utfStr.c_str()));
return "";
}
return uniStr;
@ -178,11 +179,6 @@ int main()
vector<string> res;
string title = "我来到北京清华大学";
/*segment.cutMM(title, res);
for(int i = 0; i < res.size(); i++)
{
cout<<res[i]<<endl;
}*/
segment.cutDAG(title, res);
for(int i = 0; i < res.size(); i++)
{

View File

@ -42,7 +42,6 @@ namespace CppJieba
bool Trie::_buildTree(const char* const filePath)
{
char msgBuf[bufSize];
if(NULL != _root)
{
LogError("already initted!");
@ -58,8 +57,7 @@ namespace CppJieba
splitStr(line, vecBuf, " ");
if(3 != vecBuf.size())
{
sprintf(msgBuf, "line[%s] illegal.", line.c_str());
LogError(msgBuf);
LogError(string_format("line[%s] illegal.", line.c_str()));
return false;
}
string chWord = vecBuf[0];