Esempio n. 1
0
char* logger::
format_footer(const logger::msg& a_msg, char* a_buf, const char* a_end)
{
    char* p = a_buf;
    auto  n = a_msg.src_loc_len() + 2;

    // Format the message in the form:
    // Timestamp|Level|Ident|Category|Message|File:Line FunName\n
    if (a_msg.src_loc_len() && show_location() && likely(a_buf + n < a_end)) {
        if (*(p-1) == '\n') p--;
        *p++ = ' ';
        *p++ = '[';

        p = src_info::to_string(p, a_end - p,
                                a_msg.src_location(), a_msg.src_loc_len(),
                                a_msg.src_fun_name(), a_msg.src_fun_len(),
                                show_fun_namespaces());
        *p++ = ']';
    }

    // We reached the end of the streaming sequence:
    // log_msg_info lmi; lmi << a << b << c;
    if (*p != '\n') *p++ = '\n';
    else p++;

    *p = '\0'; // Writes terminating '\0' (note: p is not incremented)
    return p;
}
Esempio n. 2
0
static void save_overview(struct membuffer *b, struct dive *dive)
{
	show_location(b, dive);
	show_utf8(b, dive->divemaster, "  <divemaster>", "</divemaster>\n", 0);
	show_utf8(b, dive->buddy, "  <buddy>", "</buddy>\n", 0);
	show_utf8(b, dive->notes, "  <notes>", "</notes>\n", 0);
	show_utf8(b, dive->suit, "  <suit>", "</suit>\n", 0);
}
Esempio n. 3
0
static void save_overview(FILE *f, struct dive *dive)
{
	save_depths(f, dive);
	save_temperatures(f, dive);
	show_duration(f, dive->surfacetime, "  <surfacetime>", "</surfacetime>\n");
	show_location(f, dive);
	show_utf8(f, dive->divemaster, "  <divemaster>","</divemaster>\n");
	show_utf8(f, dive->buddy, "  <buddy>","</buddy>\n");
	show_utf8(f, dive->notes, "  <notes>","</notes>\n");
}