file backend: log item manipulation

Extracting a meaningful description of each item from the Synthesis
engine when updating and adding items is easy to do for items of
certain known types (contacts and calendar items) and arguably an
improvement; in particular it makes tests like
TestCmdline.testSyncOutput more realistic.
This commit is contained in:
Patrick Ohly 2015-06-01 14:23:46 +02:00
parent c9a7cf1901
commit 1385ac43fb
3 changed files with 24 additions and 1 deletions

View file

@ -57,6 +57,23 @@ FileSyncSource::FileSyncSource(const SyncSourceParams &params,
if (dataformat.empty()) {
throwError(SE_HERE, "a database format must be specified");
}
std::list<std::string> fields;
std::string separator;
if (m_mimeType == "text/vcard" ||
m_mimeType == "text/x-vcard") {
fields.push_back("N_FIRST");
fields.push_back("N_MIDDLE");
fields.push_back("N_LAST");
separator = " ";
} else if (m_mimeType == "text/calendar" ||
m_mimeType == "text/x-vcalendar") {
fields.push_back("SUMMARY");
fields.push_back("LOCATION");
separator = ", ";
}
if (!fields.empty()) {
SyncSourceLogging::init(fields, separator, m_operations);
}
}
std::string FileSyncSource::getMimeType() const

View file

@ -54,7 +54,7 @@ SE_BEGIN_CXX
* - type=file:text/vcard:3.0
* - type=file:text/plain:1.0
*/
class FileSyncSource : public TrackingSyncSource, private boost::noncopyable
class FileSyncSource : public TrackingSyncSource, public SyncSourceLogging, private boost::noncopyable
{
public:
FileSyncSource(const SyncSourceParams &params,

View file

@ -8444,6 +8444,7 @@ Comparison was impossible.
[INFO] @default/addressbook: started
[INFO] @default/addressbook: sent 1
[INFO remote@client] @client/addressbook: started
[INFO remote@client] @client/addressbook: adding "John Doe"
[INFO remote@client] @client/addressbook: received 1/1
[INFO] @default/addressbook: first time sync done successfully
[INFO remote@client] @client/addressbook: first time sync done successfully
@ -8772,6 +8773,7 @@ END:VCARD END:VCARD
[INFO] @default/addressbook: started
[INFO] @default/addressbook: sent 1
[INFO remote@client] @client/addressbook: started
[INFO remote@client] @client/addressbook: updating "Joan Doe"
[INFO remote@client] @client/addressbook: received 1/1
[INFO] @default/addressbook: normal sync done successfully
[INFO remote@client] @client/addressbook: normal sync done successfully
@ -8869,6 +8871,7 @@ END:VCARD <
[INFO] @default/addressbook: started
[INFO] @default/addressbook: sent 1
[INFO remote@client] @client/addressbook: started
[INFO remote@client] @client/addressbook: deleting <0>
[INFO remote@client] @client/addressbook: received 1/1
[INFO] @default/addressbook: normal sync done successfully
[INFO remote@client] @client/addressbook: normal sync done successfully
@ -8982,6 +8985,7 @@ Comparison was impossible.
[INFO] @default/calendar: started
[INFO] @default/addressbook: sent 1
[INFO remote@client] @client/addressbook: started
[INFO remote@client] @client/addressbook: adding "John Doe"
[INFO remote@client] @client/addressbook: received 1/1
[INFO remote@client] @client/calendar: started
[INFO] @default/addressbook: first time sync done successfully
@ -9215,6 +9219,7 @@ no changes
[INFO] @default/calendar: started
[INFO] @default/addressbook: sent 1
[INFO remote@client] @client/addressbook: started
[INFO remote@client] @client/addressbook: updating "Joan Doe"
[INFO remote@client] @client/addressbook: received 1/1
[INFO remote@client] @client/calendar: started
[INFO] @default/addressbook: normal sync done successfully
@ -9337,6 +9342,7 @@ no changes
[INFO] @default/calendar: started
[INFO] @default/addressbook: sent 1
[INFO remote@client] @client/addressbook: started
[INFO remote@client] @client/addressbook: deleting <0>
[INFO remote@client] @client/addressbook: received 1/1
[INFO remote@client] @client/calendar: started
[INFO] @default/addressbook: normal sync done successfully