Skip to content

Commit

Permalink
if global tag_output set, appends e.g. "(J)" to msgs to indicate how …
Browse files Browse the repository at this point in the history
…generated
  • Loading branch information
rockowitz committed Jan 11, 2025
1 parent d5b322e commit 604e8bf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
17 changes: 10 additions & 7 deletions src/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,27 +608,30 @@ static bool vdbgtrc(

// if (trace_to_syslog || (options & DBGTRC_OPTIONS_SYSLOG)) {
if (test_emit_syslog(DDCA_SYSLOG_DEBUG) || dbgtrc_trace_to_syslog_only) {
char * syslog_msg = g_strdup_printf("%s%s(%-30s) %s%s (J)",
thread_prefix, elapsed_prefix, funcname, retval_info, base_msg);
char * syslog_msg = g_strdup_printf("%s%s(%-30s) %s%s%s",
thread_prefix, elapsed_prefix, funcname, retval_info, base_msg,
(tag_output) ? " (J)" : "");
syslog(LOG_DEBUG, "%s", syslog_msg);
free(syslog_msg);
}
else if ( (options & DBGTRC_OPTIONS_SEVERE) && test_emit_syslog(DDCA_SYSLOG_ERROR)) {
char * syslog_msg = g_strdup_printf("%s(%-30s) %s%s (K)",
elapsed_prefix, funcname, retval_info, base_msg);
char * syslog_msg = g_strdup_printf("%s(%-30s) %s%s%s",
elapsed_prefix, funcname, retval_info, base_msg,
(tag_output) ? " (K)" : "" );
syslog(LOG_ERR, "%s", syslog_msg);
free(syslog_msg);
}
else if (redirect_reports_to_syslog) {
syslog(LOG_NOTICE, "%s(%-30s) %s%s (L)",
elapsed_prefix, funcname, retval_info, base_msg);
syslog(LOG_NOTICE, "%s(%-30s) %s%s%s",
elapsed_prefix, funcname, retval_info, base_msg,
(tag_output) ? " (L)" : "" );
}

if (!dbgtrc_trace_to_syslog_only && !stdout_stderr_redirected && !redirect_reports_to_syslog) {
FILE * where = (options & DBGTRC_OPTIONS_SEVERE)
? thread_settings->ferr
: thread_settings->fout;
f0printf(where, "%s (M)\n", decorated_msg);
f0printf(where, "%s%s\n", decorated_msg, (tag_output) ? " (M)" : "" );
// f0puts(decorated_msg, where);
// f0putc('\n', where);
fflush(where);
Expand Down
4 changes: 2 additions & 2 deletions src/base/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ do { \
if (rpt_get_ornamentation_enabled() ) { \
get_msg_decoration(prefix, 100, true); \
} \
syslog(syslog_priority, "%s%s (N)", prefix, body); \
syslog(syslog_priority, "%s%s%s", prefix, body, (tag_output) ? " (N)" : "" ); \
free(body); \
} \
} \
Expand All @@ -585,7 +585,7 @@ do { \
int syslog_priority = syslog_importance_from_ddcutil_syslog_level(_ddcutil_severity); \
if (syslog_priority >= 0) { \
char * body = g_strdup_printf(format, ##__VA_ARGS__); \
syslog(syslog_priority, "%s (P)", body); \
syslog(syslog_priority, "%s%s", body, (tag_output) ? " (P)" : "" ); \
free(body); \
} \
} \
Expand Down
3 changes: 2 additions & 1 deletion src/util/report_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ void rpt_title_collect(const char * title, GPtrArray * collector, int depth) {
else {
if (depth >= 0) {
if (redirect_reports_to_syslog)
syslog(LOG_NOTICE, "%s%*s%s (I)", prefix, rpt_get_indent(depth), "", title);
syslog(LOG_NOTICE, "%s%*s%s%s",
prefix, rpt_get_indent(depth), "", title, (tag_output) ? " (I)" : "");
else
f0printf(rpt_cur_output_dest(), "%s%*s%s\n", prefix, rpt_get_indent(depth), "", title);
}
Expand Down

0 comments on commit 604e8bf

Please sign in to comment.