mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
opt: debug log message
convert GDPRINTF macro to gdDebug internal
This commit is contained in:
parent
609cfa74b5
commit
dab5885b02
24
gddebug.cc
24
gddebug.cc
|
@ -42,23 +42,23 @@ void gdDebug(const char *msg, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
QTextCodec *localeCodec = 0;
|
// QTextCodec *localeCodec = 0;
|
||||||
|
|
||||||
if( logFilePtr && logFilePtr->isOpen() )
|
// if( logFilePtr && logFilePtr->isOpen() )
|
||||||
{
|
// {
|
||||||
if( utf8Codec == 0 )
|
// if( utf8Codec == 0 )
|
||||||
utf8Codec = QTextCodec::codecForName( "UTF8" );
|
// utf8Codec = QTextCodec::codecForName( "UTF8" );
|
||||||
|
|
||||||
localeCodec = QTextCodec::codecForLocale();
|
// localeCodec = QTextCodec::codecForLocale();
|
||||||
QTextCodec::setCodecForLocale( utf8Codec );
|
// QTextCodec::setCodecForLocale( utf8Codec );
|
||||||
}
|
// }
|
||||||
|
|
||||||
qDebug()<< QString().vasprintf( msg, ap );
|
qDebug()<< QString().vasprintf( msg, ap );
|
||||||
|
|
||||||
if( logFilePtr && logFilePtr->isOpen() )
|
// if( logFilePtr && logFilePtr->isOpen() )
|
||||||
{
|
// {
|
||||||
QTextCodec::setCodecForLocale( localeCodec );
|
// QTextCodec::setCodecForLocale( localeCodec );
|
||||||
}
|
// }
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#define GD_DPRINTF(...) do {} while( 0 )
|
#define GD_DPRINTF(...) do {} while( 0 )
|
||||||
#define GD_FDPRINTF(...) do {} while( 0 )
|
#define GD_FDPRINTF(...) do {} while( 0 )
|
||||||
#else
|
#else
|
||||||
#define GD_DPRINTF(...) printf(__VA_ARGS__)
|
#define GD_DPRINTF(...) gdDebug(__VA_ARGS__)
|
||||||
#define GD_FDPRINTF(...) fprintf(__VA_ARGS__)
|
#define GD_FDPRINTF(...) fprintf(__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ bool MdictParser::open( const char * filename )
|
||||||
filename_ = QString::fromUtf8( filename );
|
filename_ = QString::fromUtf8( filename );
|
||||||
file_ = new QFile( filename_ );
|
file_ = new QFile( filename_ );
|
||||||
|
|
||||||
GD_DPRINTF( "MdictParser: open %s\n", filename );
|
gdDebug( "MdictParser: open %s", filename );
|
||||||
|
|
||||||
if ( file_.isNull() || !file_->exists() )
|
if ( file_.isNull() || !file_->exists() )
|
||||||
return false;
|
return false;
|
||||||
|
|
6
mdx.cc
6
mdx.cc
|
@ -523,7 +523,7 @@ void MdxDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
|
||||||
if( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
if( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gdDebug( "MDict: Building the full-text index for dictionary: %s\n",
|
gdDebug( "MDict: Building the full-text index for dictionary: %s",
|
||||||
getName().c_str() );
|
getName().c_str() );
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -533,7 +533,7 @@ void MdxDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
|
||||||
}
|
}
|
||||||
catch( std::exception &ex )
|
catch( std::exception &ex )
|
||||||
{
|
{
|
||||||
gdWarning( "MDict: Failed building full-text search index for \"%s\", reason: %s\n", getName().c_str(), ex.what() );
|
gdWarning( "MDict: Failed building full-text search index for \"%s\", reason: %s", getName().c_str(), ex.what() );
|
||||||
QFile::remove( FsEncoding::decode( ftsIdxName.c_str() ) );
|
QFile::remove( FsEncoding::decode( ftsIdxName.c_str() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -550,7 +550,7 @@ void MdxDictionary::getArticleText( uint32_t articleAddress, QString & headword,
|
||||||
}
|
}
|
||||||
catch( std::exception &ex )
|
catch( std::exception &ex )
|
||||||
{
|
{
|
||||||
gdWarning( "MDict: Failed retrieving article from \"%s\", reason: %s\n", getName().c_str(), ex.what() );
|
gdWarning( "MDict: Failed retrieving article from \"%s\", reason: %s", getName().c_str(), ex.what() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue