Rename log_buffer_get_tag to dlogutil_entry_tag 79/216679/4
authorMateusz Majewski <m.majewski2@samsung.com>
Wed, 30 Oct 2019 14:30:11 +0000 (15:30 +0100)
committerMateusz Majewski <m.majewski2@samsung.com>
Wed, 6 Nov 2019 13:50:52 +0000 (14:50 +0100)
Change-Id: I2b98af866377c176415e2113df3fc36dae21d893

Makefile.am
include/logprint.h
src/shared/log_file.c
src/shared/logprint.c
src/tests/kmsg_parser.c
src/tests/log_file.c
src/tests/logprint.c
src/tests/syslog_parser.c

index 5b81d09..fb7299a 100644 (file)
@@ -271,7 +271,7 @@ src_tests_libdlog_base_LDFLAGS = $(AM_LDFLAGS) -lpthread -Wl,--wrap=log_config_r
 
 src_tests_log_file_SOURCES = src/tests/log_file.c src/shared/log_file.c
 src_tests_log_file_CFLAGS = $(check_CFLAGS)
-src_tests_log_file_LDFLAGS = $(AM_LDFLAGS) -Wl,--wrap=strdup,--wrap=free,--wrap=memcpy,--wrap=snprintf,--wrap=open,--wrap=fstat,--wrap=rename,--wrap=dlogutil_entry_ts,--wrap=log_print_log_line,--wrap=log_buffer_get_tag
+src_tests_log_file_LDFLAGS = $(AM_LDFLAGS) -Wl,--wrap=strdup,--wrap=free,--wrap=memcpy,--wrap=snprintf,--wrap=open,--wrap=fstat,--wrap=rename,--wrap=dlogutil_entry_ts,--wrap=log_print_log_line,--wrap=dlogutil_entry_tag
 
 src_tests_queued_entry_SOURCES = src/tests/queued_entry.c src/shared/queued_entry.c src/shared/queued_entry_timestamp.c src/shared/parsers.c src/shared/translate_syslog.c src/shared/logconfig.c src/shared/logcommon.c
 src_tests_queued_entry_CFLAGS = $(check_CFLAGS)
index b87d010..3f09a77 100644 (file)
@@ -159,7 +159,7 @@ bool log_should_print_line(
  *
  * Finds the beginning of a log tag in entry's payload and returns it
  */
-const char* log_buffer_get_tag(const struct dlogutil_entry *entry);
+const char* dlogutil_entry_tag(const struct dlogutil_entry *entry);
 
 /**
  * Returns pointer to log entry message
index c0d768c..bf8a1c6 100644 (file)
@@ -227,7 +227,7 @@ int logfile_write_with_rotation(const struct dlogutil_entry *e, struct log_file
        if (ts.tv_sec < file->prev_sec || (ts.tv_sec == file->prev_sec && ts.tv_nsec < file->prev_nsec)) {
                struct dlogutil_entry_with_msg msg;
                memcpy(&msg, e, sizeof *e);
-               int r = snprintf(msg.msg, sizeof msg.msg, "%s%c%s", log_buffer_get_tag(e), '\0', "INFO: Following log entry could not be sorted and is out of order.");
+               int r = snprintf(msg.msg, sizeof msg.msg, "%s%c%s", dlogutil_entry_tag(e), '\0', "INFO: Following log entry could not be sorted and is out of order.");
 
                if (r < 0) {
                        ERR("unable to format out-of-order message %m");
index 5352518..ccb6489 100644 (file)
@@ -211,7 +211,7 @@ bool log_should_print_line(struct dlogutil_filter_options *p_filter, const struc
        const char *tag;
        log_priority prio;
 
-       tag = log_buffer_get_tag(entry);
+       tag = dlogutil_entry_tag(entry);
        /* mark empty-tagged messages and make it easy to catch an application that does that */
        if (!tag || !strlen(tag))
                tag = "DLOG_ERROR_NOTAG";
@@ -540,7 +540,7 @@ int log_add_filter_tid(struct dlogutil_filter_options *p_filter, pid_t tid)
  * @param[in] entry The log entry
  * @return Pointer to log tag
  */
-const char* log_buffer_get_tag(const struct dlogutil_entry *entry)
+const char* dlogutil_entry_tag(const struct dlogutil_entry *entry)
 {
        assert(entry);
 
@@ -927,7 +927,7 @@ char *log_format_log_line(
 
        priChar = filter_pri_to_char((log_priority)entry->priority);
 
-       tag = log_buffer_get_tag(entry);
+       tag = dlogutil_entry_tag(entry);
        /* mark empty-tagged messages and make it easy to catch an application that does that */
        if (!tag || !strlen(tag))
                tag = "DLOG_ERROR_NOTAG";
index be5ae9f..50330f8 100644 (file)
@@ -24,8 +24,8 @@ void assert_entry(char const * msg, const struct dlogutil_entry_with_msg *expect
        assert(expected->header.pid == lem.header.pid);
        assert(expected->header.tid == lem.header.tid);
 
-       const char *const tag_expected = log_buffer_get_tag(&expected->header);
-       const char *const tag_actual   = log_buffer_get_tag(&lem.header);
+       const char *const tag_expected = dlogutil_entry_tag(&expected->header);
+       const char *const tag_actual   = dlogutil_entry_tag(&lem.header);
        const char *const msg_expected = log_buffer_get_message(&expected->header);
        const char *const msg_actual   = log_buffer_get_message(&lem.header);
        assert(tag_expected);
index f03d45c..b6762f3 100644 (file)
@@ -44,7 +44,7 @@ struct timespec __wrap_dlogutil_entry_ts(const struct dlogutil_entry *le, enum d
        };
 }
 
-char *__wrap_log_buffer_get_tag(const struct dlogutil_entry *entry)
+char *__wrap_dlogutil_entry_tag(const struct dlogutil_entry *entry)
 {
        assert(entry == (struct dlogutil_entry *) 0xBA5EBALL);
        return "";
index d6b4b62..1ac3e0a 100644 (file)
@@ -596,7 +596,7 @@ void check_invalid_input()
 {
        const struct dlogutil_entry entry = { .len = 1 };
        assert(!log_buffer_get_message(&entry));
-       assert(!log_buffer_get_tag(&entry));
+       assert(!dlogutil_entry_tag(&entry));
 
        struct dlogutil_filter_options *const filter = log_filter_new();
        assert(filter);
index 7770a7d..21c1a4c 100644 (file)
@@ -67,7 +67,7 @@ int main()
 
        assert(sle->pid == 678);
        assert(sle->priority == DLOG_FATAL);
-       assert(!strcmp("SYSLOG_USER", log_buffer_get_tag(sle)));
+       assert(!strcmp("SYSLOG_USER", dlogutil_entry_tag(sle)));
        assert(!strcmp("msg", log_buffer_get_message(sle)));
 
        // Valid
@@ -76,7 +76,7 @@ int main()
 
        assert(sle->pid == 0);
        assert(sle->priority == DLOG_FATAL);
-       assert(!strcmp("SYSLOG_USER", log_buffer_get_tag(sle)));
+       assert(!strcmp("SYSLOG_USER", dlogutil_entry_tag(sle)));
        assert(!strcmp("msg", log_buffer_get_message(sle)));
 
        return 0;