Use new logging api of csync.

This commit is contained in:
Klaas Freitag 2012-12-04 17:24:46 +01:00
parent 34dcff4ce2
commit 22128781be
2 changed files with 12 additions and 9 deletions

View file

@ -12,7 +12,6 @@
* for more details.
*/
#define LOG_TO_CALLBACK // FIXME: This should be in csync.
#include <iostream>
#include "mirall/application.h"
@ -38,8 +37,6 @@
#endif
#include "mirall/inotify.h"
#include <csync.h>
#include <QtCore>
#include <QtGui>
#include <QHash>
@ -59,11 +56,6 @@ void mirallLogCatcher(QtMsgType type, const char *msg)
Logger::instance()->mirallLog( QString::fromUtf8(msg) );
}
void csyncLogCatcher(const char *msg)
{
Logger::instance()->csyncLog( QString::fromUtf8(msg) );
}
// ----------------------------------------------------------------------------------
Application::Application(int &argc, char **argv) :
@ -522,7 +514,6 @@ void Application::setupLogBrowser()
// init the log browser.
_logBrowser = new LogBrowser;
qInstallMsgHandler( mirallLogCatcher );
csync_set_log_callback( csyncLogCatcher );
// ## TODO: allow new log name maybe?
if (!_logFile.isEmpty()) {
qDebug() << "Logging into logfile: " << _logFile << " with flush " << _logFlush;

View file

@ -16,6 +16,7 @@
#include "mirall/csyncthread.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/theme.h"
#include "mirall/logbrowser.h"
#include <QDebug>
#include <QDir>
@ -37,6 +38,15 @@ QString CSyncThread::_csyncConfigDir; // to be able to remove the lock file.
QMutex CSyncThread::_mutex;
void csyncLogCatcher(CSYNC *ctx,
int verbosity,
const char *function,
const char *buffer,
void *userdata)
{
Logger::instance()->csyncLog( QString::fromUtf8(function) + QLatin1String("> ") + QString::fromUtf8(buffer) );
}
struct proxyInfo_s {
char *proxyType;
char *proxyHost;
@ -213,6 +223,8 @@ void CSyncThread::startSync()
qDebug() << "## CSync Thread local only: " << _localCheckOnly;
csync_set_auth_callback( csync, getauth );
csync_set_log_callback( csync, csyncLogCatcher );
csync_enable_conflictcopys(csync);