diary

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

commit 5928abacca520b1c45e0016a45b26a1d09fbf286
parent 93dac25a5bc217be7e7c7c5aa3dacd27b3614c14
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Sun, 26 Jun 2022 21:21:34 +0200

feat(lttng): add err tracer

Diffstat:
Msrc/caldav.c | 2+-
Msrc/diary-tp.h | 22++++++++++++++--------
Msrc/diary.c | 2+-
3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/caldav.c b/src/caldav.c @@ -31,7 +31,7 @@ static size_t curl_write_mem_callback(void * contents, size_t size, size_t nmemb char* ptr = realloc(mem->memory, mem->size + realsize + 1); if (!ptr) { - fprintf(stderr, "Error - not enough memory (realloc in CURLOPT_WRITEFUNCTION returned NULL)\n"); + tracepoint(diary, error, "Not enough memory (realloc in CURLOPT_WRITEFUNCTION returned NULL)"); return 0; } diff --git a/src/diary-tp.h b/src/diary-tp.h @@ -16,19 +16,24 @@ // Instrument a C user application // https://lttng.org/docs/v2.13/#doc-c-application + TRACEPOINT_EVENT( - /* Tracepoint provider name */ diary, + error, + TP_ARGS( + char*, msg_arg + ), + TP_FIELDS( + ctf_string(msg, msg_arg) + ) +) - /* Tracepoint name */ +TRACEPOINT_EVENT( + diary, debug, - - /* Input arguments */ TP_ARGS( char*, msg_arg ), - - /* Output event fields */ TP_FIELDS( ctf_string(msg, msg_arg) ) @@ -49,7 +54,7 @@ TRACEPOINT_EVENT( TRACEPOINT_EVENT( diary, - warning, + warning_2strings, TP_ARGS( char*, msg_arg, char*, arg1 @@ -65,9 +70,10 @@ TRACEPOINT_EVENT( // TRACE_WARNING // TRACE_INFO // TRACE_DEBUG_LINE (default) +TRACEPOINT_LOGLEVEL(diary, error, TRACE_ERR) TRACEPOINT_LOGLEVEL(diary, debug, TRACE_DEBUG) TRACEPOINT_LOGLEVEL(diary, debug_date, TRACE_DEBUG) -TRACEPOINT_LOGLEVEL(diary, warning, TRACE_WARNING) +TRACEPOINT_LOGLEVEL(diary, warning_2strings, TRACE_WARNING) #endif /* _DIARY_TP_H */ diff --git a/src/diary.c b/src/diary.c @@ -298,7 +298,7 @@ bool read_config(const char* file_path) { // check if config file is readable if( access( config_file_path, R_OK ) != 0 ) { - tracepoint(diary, warning, "Config file missing or not readable, skipping", config_file_path); + tracepoint(diary, warning_2strings, "Config file missing or not readable, skipping", config_file_path); return false; }