summaryrefslogtreecommitdiff
path: root/src/shared/logs-show.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 11:58:34 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 12:04:41 +0100
commit0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (patch)
tree50117277be2e2078d0373b944a30b4f09bb94443 /src/shared/logs-show.c
parentb4d23205f238e06aaa31264628e20669e714acad (diff)
treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
Diffstat (limited to 'src/shared/logs-show.c')
-rw-r--r--src/shared/logs-show.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index e33824be4a..32eba6ccfe 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -296,7 +296,7 @@ static int output_short(
r = sd_journal_get_monotonic_usec(j, &t, &boot_id);
if (r < 0) {
- log_error("Failed to get monotonic timestamp: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get monotonic timestamp: %m");
return r;
}
@@ -323,7 +323,7 @@ static int output_short(
r = sd_journal_get_realtime_usec(j, &x);
if (r < 0) {
- log_error("Failed to get realtime timestamp: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get realtime timestamp: %m");
return r;
}
@@ -422,7 +422,7 @@ static int output_verbose(
r = parse_field(data, length, "_SOURCE_REALTIME_TIMESTAMP=", &value, &size);
if (r < 0)
- log_debug("_SOURCE_REALTIME_TIMESTAMP invalid: %s", strerror(-r));
+ log_debug_errno(-r, "_SOURCE_REALTIME_TIMESTAMP invalid: %m");
else {
r = safe_atou64(value, &realtime);
if (r < 0)
@@ -442,7 +442,7 @@ static int output_verbose(
r = sd_journal_get_cursor(j, &cursor);
if (r < 0) {
- log_error("Failed to get cursor: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get cursor: %m");
return r;
}
@@ -517,19 +517,19 @@ static int output_export(
r = sd_journal_get_realtime_usec(j, &realtime);
if (r < 0) {
- log_error("Failed to get realtime timestamp: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get realtime timestamp: %m");
return r;
}
r = sd_journal_get_monotonic_usec(j, &monotonic, &boot_id);
if (r < 0) {
- log_error("Failed to get monotonic timestamp: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get monotonic timestamp: %m");
return r;
}
r = sd_journal_get_cursor(j, &cursor);
if (r < 0) {
- log_error("Failed to get cursor: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get cursor: %m");
return r;
}
@@ -657,19 +657,19 @@ static int output_json(
r = sd_journal_get_realtime_usec(j, &realtime);
if (r < 0) {
- log_error("Failed to get realtime timestamp: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get realtime timestamp: %m");
return r;
}
r = sd_journal_get_monotonic_usec(j, &monotonic, &boot_id);
if (r < 0) {
- log_error("Failed to get monotonic timestamp: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get monotonic timestamp: %m");
return r;
}
r = sd_journal_get_cursor(j, &cursor);
if (r < 0) {
- log_error("Failed to get cursor: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get cursor: %m");
return r;
}
@@ -877,7 +877,7 @@ static int output_cat(
if (r == -ENOENT)
return 0;
- log_error("Failed to get data: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get data: %m");
return r;
}
@@ -1226,13 +1226,13 @@ int add_match_this_boot(sd_journal *j, const char *machine) {
if (machine) {
r = get_boot_id_for_machine(machine, &boot_id);
if (r < 0) {
- log_error("Failed to get boot id of container %s: %s", machine, strerror(-r));
+ log_error_errno(-r, "Failed to get boot id of container %s: %m", machine);
return r;
}
} else {
r = sd_id128_get_boot(&boot_id);
if (r < 0) {
- log_error("Failed to get boot id: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get boot id: %m");
return r;
}
}
@@ -1240,7 +1240,7 @@ int add_match_this_boot(sd_journal *j, const char *machine) {
sd_id128_to_string(boot_id, match + 9);
r = sd_journal_add_match(j, match, strlen(match));
if (r < 0) {
- log_error("Failed to add match: %s", strerror(-r));
+ log_error_errno(-r, "Failed to add match: %m");
return r;
}