summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/eina/eina_log.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/lib/eina/eina_log.c b/src/lib/eina/eina_log.c
index f3d6345551..9146ba2745 100644
--- a/src/lib/eina/eina_log.c
+++ b/src/lib/eina/eina_log.c
@@ -1927,28 +1927,41 @@ eina_log_print_cb_journald(const Eina_Log_Domain *d,
1927 va_list args) 1927 va_list args)
1928{ 1928{
1929#ifdef HAVE_SYSTEMD 1929#ifdef HAVE_SYSTEMD
1930 char buf[12]; 1930 char *file_prefixed = NULL;
1931 char *tmp; 1931 char *line_str = NULL;
1932 char *message = NULL;
1932 Eina_Thread cur; 1933 Eina_Thread cur;
1933 int r; 1934 int r;
1934 1935
1935 r = vasprintf(&tmp, fmt, args); 1936 r = asprintf(&file_prefixed, "CODE_FILE=%s", file);
1936 if (r == -1) 1937 if (r == -1)
1937 { 1938 {
1938 fputs("ERR: eina_log_print_cb_journald() vasprintf failed\n", stderr); 1939 fputs("ERR: eina_log_print_cb_journald() asprintf failed\n", stderr);
1939 return; 1940 goto finish;
1940 } 1941 }
1941 1942
1942 eina_convert_itoa(line, buf); 1943 r = asprintf(&line_str, "CODE_LINE=%d", line);
1944 if (r == -1)
1945 {
1946 fputs("ERR: eina_log_print_cb_journald() asprintf failed\n", stderr);
1947 goto finish;
1948 }
1949
1950 r = vasprintf(&message, fmt, args);
1951 if (r == -1)
1952 {
1953 fputs("ERR: eina_log_print_cb_journald() vasprintf failed\n", stderr);
1954 goto finish;
1955 }
1943 1956
1944 cur = SELF(); 1957 cur = SELF();
1945 1958
1946#ifdef EINA_LOG_BACKTRACE 1959#ifdef EINA_LOG_BACKTRACE
1947 if (EINA_LIKELY(level >= _backtrace_level)) 1960 if (EINA_LIKELY(level >= _backtrace_level))
1948#endif 1961#endif
1949 sd_journal_send_with_location(file, buf, fnc, 1962 sd_journal_send_with_location(file_prefixed, line_str, fnc,
1950 "PRIORITY=%i", level, 1963 "PRIORITY=%i", level,
1951 "MESSAGE=%s", tmp, 1964 "MESSAGE=%s", message,
1952 "EFL_DOMAIN=%s", d->domain_str, 1965 "EFL_DOMAIN=%s", d->domain_str,
1953 "THREAD=%lu", cur, 1966 "THREAD=%lu", cur,
1954 NULL); 1967 NULL);
@@ -1971,9 +1984,9 @@ eina_log_print_cb_journald(const Eina_Log_Domain *d,
1971 else 1984 else
1972 eina_strbuf_append_printf(bts, "[%s], ", strings[i]); 1985 eina_strbuf_append_printf(bts, "[%s], ", strings[i]);
1973 1986
1974 sd_journal_send_with_location(file, buf, fnc, 1987 sd_journal_send_with_location(file_prefixed, line_str, fnc,
1975 "PRIORITY=%i", level, 1988 "PRIORITY=%i", level,
1976 "MESSAGE=%s", tmp, 1989 "MESSAGE=%s", message,
1977 "EFL_DOMAIN=%s", d->domain_str, 1990 "EFL_DOMAIN=%s", d->domain_str,
1978 "THREAD=%lu", cur, 1991 "THREAD=%lu", cur,
1979 "BACKTRACE=%s", 1992 "BACKTRACE=%s",
@@ -1984,7 +1997,10 @@ eina_log_print_cb_journald(const Eina_Log_Domain *d,
1984 } 1997 }
1985#endif 1998#endif
1986 1999
1987 free(tmp); 2000finish:
2001 free(file_prefixed);
2002 free(line_str);
2003 free(message);
1988 2004
1989#else 2005#else
1990 eina_log_print_cb_stderr(d, level, file, fnc, line, fmt, data, args); 2006 eina_log_print_cb_stderr(d, level, file, fnc, line, fmt, data, args);