void couchdb_document_contact_address_set_city (CouchdbStructField *sf, const char *city) { g_return_if_fail (sf != NULL); couchdb_struct_field_set_string_field (sf, "city", city); }
void couchdb_document_contact_phone_set_description (CouchdbStructField *sf, const char *description) { g_return_if_fail (sf != NULL); couchdb_struct_field_set_string_field (sf, "description", description); }
void couchdb_document_contact_address_set_ext_street (CouchdbStructField *sf, const char *ext_street) { g_return_if_fail (sf != NULL); couchdb_struct_field_set_string_field (sf, "address2", ext_street); }
void couchdb_document_contact_address_set_state (CouchdbStructField *sf, const char *state) { g_return_if_fail (sf != NULL); couchdb_struct_field_set_string_field (sf, "state", state); }
void couchdb_document_contact_address_set_pobox (CouchdbStructField *sf, const char *pobox) { g_return_if_fail (sf != NULL); couchdb_struct_field_set_string_field (sf, "pobox", pobox); }
void desktopcouch_document_contact_address_set_postalcode (CouchdbStructField *sf, const char *postalcode) { g_return_if_fail (sf != NULL); couchdb_struct_field_set_string_field (sf, "postalcode", postalcode); }
void desktopcouch_document_contact_address_set_country (CouchdbStructField *sf, const char *country) { g_return_if_fail (sf != NULL); couchdb_struct_field_set_string_field (sf, "country", country); }
void desktopcouch_document_contact_address_set_street (CouchdbStructField *sf, const char *street) { g_return_if_fail (sf != NULL); couchdb_struct_field_set_string_field (sf, "street", street); }
void couchdb_document_contact_phone_set_number (CouchdbStructField *sf, const char *number) { g_return_if_fail (sf != NULL); g_return_if_fail (number != NULL); couchdb_struct_field_set_string_field (sf, "number", number); }
void couchdb_document_contact_email_set_address (CouchdbStructField *sf, const char *email) { g_return_if_fail (sf != NULL); g_return_if_fail (email != NULL); couchdb_struct_field_set_string_field (sf, "address", email); }
void couchdb_document_contact_im_set_protocol (CouchdbStructField *sf, const char *protocol) { g_return_if_fail (sf != NULL); g_return_if_fail (protocol != NULL); couchdb_struct_field_set_string_field (sf, "protocol", protocol); }
void couchdb_document_contact_im_set_address (CouchdbStructField *sf, const char *address) { g_return_if_fail (sf != NULL); g_return_if_fail (address != NULL); couchdb_struct_field_set_string_field (sf, "address", address); }
void desktopcouch_document_contact_url_set_address (CouchdbStructField *sf, const char *url) { g_return_if_fail (sf != NULL); g_return_if_fail (url != NULL); couchdb_struct_field_set_string_field (sf, "address", url); }
static CouchdbDocument * format_document(Log4gLayout *base, Log4gLoggingEvent *event) { CouchdbDocument *document = couchdb_document_new(); if (!document) { return NULL; } /* destopcouch schema */ couchdb_document_set_string_field(document, "record_type", "http://msteinert.github.com/log4g/couchdb"); couchdb_document_set_string_field(document, "record_type_version", "1.0"); /* message */ const gchar *string = log4g_logging_event_get_message(event); couchdb_document_set_string_field(document, "message", string ? string : ""); /* log level */ Log4gLevel *level = log4g_logging_event_get_level(event); if (level) { couchdb_document_set_string_field(document, "level", log4g_level_to_string(level)); } /* logger name */ string = log4g_logging_event_get_logger_name(event); if (string) { couchdb_document_set_string_field(document, "logger", string); } /* MDC */ const GArray *keys = log4g_logging_event_get_property_key_set(event); if (keys) { CouchdbStructField *mdc = couchdb_struct_field_new(); if (mdc) { for (gint i = 0; i < keys->len; ++i) { string = g_array_index(keys, const gchar *, i); couchdb_struct_field_set_string_field( mdc, string, log4g_logging_event_get_mdc( event, string)); } couchdb_document_set_struct_field(document, "mdc", mdc); } } /* NDC */ string = log4g_logging_event_get_ndc(event); if (string) { couchdb_document_set_string_field(document, "ndc", string); } /* timestamp */ GTimeVal *tv = log4g_logging_event_get_time_stamp(event); if (tv) { gchar string[64]; g_snprintf(string, sizeof string, "%lu", (gulong)((tv->tv_sec * 1000) + (tv->tv_usec * 0.001))); couchdb_document_set_string_field(document, "timestamp", string); } /* thread */ string = log4g_logging_event_get_thread_name(event); if (string) { couchdb_document_set_string_field(document, "thread", string); } /* function */ string = log4g_logging_event_get_function_name(event); if (string) { couchdb_document_set_string_field(document, "function", string); } /* file */ string = log4g_logging_event_get_file_name(event); if (string) { couchdb_document_set_string_field(document, "file", string); } /* line */ string = log4g_logging_event_get_line_number(event); if (string) { couchdb_document_set_string_field(document, "line", string); } return document; }