diary

Text-based journaling program
git clone https://git.in0rdr.ch/diary.git
Log | Files | Refs | README | LICENSE

commit e61a727feb8f197a71ee27c728ade866a35bf838
parent 0c9596f151ef0e7d68fe60ffb78037bc25265544
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Sun, 26 Jun 2022 21:56:01 +0200

feat(lttng): add error_int_long tracer

Diffstat:
Msrc/diary-tp.h | 16++++++++++++++++
Msrc/export.c | 7+++----
2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/diary-tp.h b/src/diary-tp.h @@ -43,6 +43,21 @@ TRACEPOINT_EVENT( TRACEPOINT_EVENT( diary, + error_int_long, + TP_ARGS( + char*, msg_arg, + int, n_arg, + long, m_arg + ), + TP_FIELDS( + ctf_string(msg, msg_arg) + ctf_integer(int, n, n_arg) + ctf_integer(long, m, m_arg) + ) +) + +TRACEPOINT_EVENT( + diary, debug, TP_ARGS( char*, msg_arg @@ -72,6 +87,7 @@ TRACEPOINT_EVENT( // TRACE_DEBUG_LINE (default) TRACEPOINT_LOGLEVEL(diary, error, TRACE_ERR) TRACEPOINT_LOGLEVEL(diary, error_date, TRACE_ERR) +TRACEPOINT_LOGLEVEL(diary, error_int_long, TRACE_ERR) TRACEPOINT_LOGLEVEL(diary, debug, TRACE_DEBUG) TRACEPOINT_LOGLEVEL(diary, warning_2strings, TRACE_WARNING) diff --git a/src/export.c b/src/export.c @@ -59,7 +59,7 @@ void ics_export(const char* ics_filepath, WINDOW* header, WINDOW* cal, WINDOW* a fpath(CONFIG.dir, dirs, &it, &ppath, sizeof path); if (ppath == NULL) { - fprintf(stderr, "Error while retrieving file path for diary reading"); + tracepoint(diary, error_date, "Cannot get file path for entry", &it); return; } @@ -83,7 +83,7 @@ void ics_export(const char* ics_filepath, WINDOW* header, WINDOW* cal, WINDOW* a // read description bytes from journal entry file and append to descr int items_read = fread(descr + descr_label_size, sizeof(char), descr_bytes, fp); if (items_read != descr_bytes) { - fprintf(stderr, "Read %i items but expected %li, aborting.", items_read, descr_bytes); + tracepoint(diary, error_int_long, "Read n items but expected m items, aborting.", items_read, descr_bytes); return; } @@ -138,4 +138,4 @@ void ics_export(const char* ics_filepath, WINDOW* header, WINDOW* cal, WINDOW* a } while (!(conf_ch == 'q' || conf_ch == 'n' || conf_ch == 'y' || conf_ch == 'Y' || conf_ch == '\n')); free(vevents); -} -\ No newline at end of file +}