diff options
author | Alejandro Exojo <suy@badopi.org> | 2014-03-10 11:40:26 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-05 13:27:05 +0200 |
commit | 0ebfd0866d7cc9e3dabccf088d8ef1339dfe51a6 (patch) | |
tree | 1b7409e62fbbfc65ce8ca91289a1d185748dce08 /config.tests/unix/journald/journald.c | |
parent | 687fbc11525fddda73ba4925d916be555df22ca9 (diff) |
Use category names when logging to the journal
Use the custom field QT_CATEGORY to store the name of the QLoggingCategory used
when writing to systemd's journal. To pass custom fields sd_journal_send() is
needed, and is used in combination with #define SD_JOURNAL_SUPPRESS_LOCATION to
store the metadata that is already in the QMessageLogContext.
Change-Id: I6a120701f7012aaa46451dd3d91586a419c5f803
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'config.tests/unix/journald/journald.c')
-rw-r--r-- | config.tests/unix/journald/journald.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/config.tests/unix/journald/journald.c b/config.tests/unix/journald/journald.c index 470d526e68..32f0de683b 100644 --- a/config.tests/unix/journald/journald.c +++ b/config.tests/unix/journald/journald.c @@ -40,9 +40,15 @@ ****************************************************************************/ #include <systemd/sd-journal.h> +#include <syslog.h> int main(int argc, char **argv) { - sd_journal_print_with_location(LOG_INFO, "CODE_FILE=foo.c", "CODE_LINE=0", "unknown_function", "test message"); + sd_journal_send("MESSAGE=%s", "test message", + "PRIORITY=%i", LOG_INFO, + "CODE_FUNC=%s", "unknown", + "CODE_LINE=%d", 0, + "CODE_FILE=%s", "foo.c", + NULL); return 0; } |