mirror of
https://github.com/systemd/systemd.git
synced 2025-01-24 06:04:05 +03:00
basic/log: add the log_struct terminator to macro
This way all callers do not need to specify it. Exhaustively tested by running test-log under valgrind ;)
This commit is contained in:
parent
4055a62faf
commit
a1230ff972
@ -245,7 +245,7 @@ int log_emergency_level(void);
|
||||
/* Structured logging */
|
||||
#define log_struct_errno(level, error, ...) \
|
||||
log_struct_internal(LOG_REALM_PLUS_LEVEL(LOG_REALM, level), \
|
||||
error, __FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
error, __FILE__, __LINE__, __func__, __VA_ARGS__, NULL)
|
||||
#define log_struct(level, ...) log_struct_errno(level, 0, __VA_ARGS__)
|
||||
|
||||
#define log_struct_iovec_errno(level, error, iovec, n_iovec) \
|
||||
|
@ -3400,29 +3400,24 @@ static int exec_child(
|
||||
_cleanup_free_ char *line;
|
||||
|
||||
line = exec_command_line(final_argv);
|
||||
if (line) {
|
||||
if (line)
|
||||
log_struct(LOG_DEBUG,
|
||||
"EXECUTABLE=%s", command->path,
|
||||
LOG_UNIT_MESSAGE(unit, "Executing: %s", line),
|
||||
LOG_UNIT_ID(unit),
|
||||
LOG_UNIT_INVOCATION_ID(unit),
|
||||
NULL);
|
||||
}
|
||||
LOG_UNIT_INVOCATION_ID(unit));
|
||||
}
|
||||
|
||||
execve(command->path, final_argv, accum_env);
|
||||
|
||||
if (errno == ENOENT && (command->flags & EXEC_COMMAND_IGNORE_FAILURE)) {
|
||||
|
||||
log_struct_errno(LOG_INFO, errno,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SPAWN_FAILED_STR,
|
||||
LOG_UNIT_ID(unit),
|
||||
LOG_UNIT_INVOCATION_ID(unit),
|
||||
LOG_UNIT_MESSAGE(unit, "Executable %s missing, skipping: %m",
|
||||
command->path),
|
||||
"EXECUTABLE=%s", command->path,
|
||||
NULL);
|
||||
|
||||
"EXECUTABLE=%s", command->path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3496,8 +3491,7 @@ int exec_spawn(Unit *unit,
|
||||
LOG_UNIT_MESSAGE(unit, "About to execute: %s", line),
|
||||
"EXECUTABLE=%s", command->path,
|
||||
LOG_UNIT_ID(unit),
|
||||
LOG_UNIT_INVOCATION_ID(unit),
|
||||
NULL);
|
||||
LOG_UNIT_INVOCATION_ID(unit));
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0)
|
||||
@ -3522,7 +3516,7 @@ int exec_spawn(Unit *unit,
|
||||
unit->manager->user_lookup_fds[1],
|
||||
&exit_status);
|
||||
|
||||
if (r < 0) {
|
||||
if (r < 0)
|
||||
log_struct_errno(LOG_ERR, r,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SPAWN_FAILED_STR,
|
||||
LOG_UNIT_ID(unit),
|
||||
@ -3530,9 +3524,7 @@ int exec_spawn(Unit *unit,
|
||||
LOG_UNIT_MESSAGE(unit, "Failed at step %s spawning %s: %m",
|
||||
exit_status_to_string(exit_status, EXIT_STATUS_SYSTEMD),
|
||||
command->path),
|
||||
"EXECUTABLE=%s", command->path,
|
||||
NULL);
|
||||
}
|
||||
"EXECUTABLE=%s", command->path);
|
||||
|
||||
_exit(exit_status);
|
||||
}
|
||||
|
@ -818,8 +818,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
|
||||
"JOB_TYPE=%s", job_type_to_string(t),
|
||||
"JOB_RESULT=%s", job_result_to_string(result),
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
NULL);
|
||||
LOG_UNIT_INVOCATION_ID(u));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -829,8 +828,7 @@ static void job_log_status_message(Unit *u, JobType t, JobResult result) {
|
||||
"JOB_RESULT=%s", job_result_to_string(result),
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
mid,
|
||||
NULL);
|
||||
mid);
|
||||
}
|
||||
|
||||
static void job_emit_status_message(Unit *u, JobType t, JobResult result) {
|
||||
@ -943,8 +941,7 @@ int job_finish_and_invalidate(Job *j, JobResult result, bool recursive, bool alr
|
||||
LOG_UNIT_MESSAGE(u, "Job %s/%s failed with result '%s'.",
|
||||
u->id,
|
||||
job_type_to_string(t),
|
||||
job_result_to_string(result)),
|
||||
NULL);
|
||||
job_result_to_string(result)));
|
||||
|
||||
unit_start_on_failure(u);
|
||||
}
|
||||
|
@ -2555,8 +2555,7 @@ static int manager_dispatch_time_change_fd(sd_event_source *source, int fd, uint
|
||||
|
||||
log_struct(LOG_DEBUG,
|
||||
"MESSAGE_ID=" SD_MESSAGE_TIME_CHANGE_STR,
|
||||
LOG_MESSAGE("Time has been changed"),
|
||||
NULL);
|
||||
LOG_MESSAGE("Time has been changed"));
|
||||
|
||||
/* Restart the watch */
|
||||
m->time_change_event_source = sd_event_source_unref(m->time_change_event_source);
|
||||
@ -3354,8 +3353,7 @@ static void log_taint_string(Manager *m) {
|
||||
log_struct(LOG_NOTICE,
|
||||
LOG_MESSAGE("System is tainted: %s", taint),
|
||||
"TAINT=%s", taint,
|
||||
"MESSAGE_ID=" SD_MESSAGE_TAINTED_STR,
|
||||
NULL);
|
||||
"MESSAGE_ID=" SD_MESSAGE_TAINTED_STR);
|
||||
}
|
||||
|
||||
static void manager_notify_finished(Manager *m) {
|
||||
@ -3402,8 +3400,7 @@ static void manager_notify_finished(Manager *m) {
|
||||
format_timespan(kernel, sizeof(kernel), kernel_usec, USEC_PER_MSEC),
|
||||
format_timespan(initrd, sizeof(initrd), initrd_usec, USEC_PER_MSEC),
|
||||
format_timespan(userspace, sizeof(userspace), userspace_usec, USEC_PER_MSEC),
|
||||
format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC)),
|
||||
NULL);
|
||||
format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC)));
|
||||
} else {
|
||||
/* The initrd-less case on bare-metal*/
|
||||
|
||||
@ -3418,8 +3415,7 @@ static void manager_notify_finished(Manager *m) {
|
||||
buf,
|
||||
format_timespan(kernel, sizeof(kernel), kernel_usec, USEC_PER_MSEC),
|
||||
format_timespan(userspace, sizeof(userspace), userspace_usec, USEC_PER_MSEC),
|
||||
format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC)),
|
||||
NULL);
|
||||
format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC)));
|
||||
}
|
||||
} else {
|
||||
/* The container and --user case */
|
||||
@ -3430,8 +3426,7 @@ static void manager_notify_finished(Manager *m) {
|
||||
"MESSAGE_ID=" SD_MESSAGE_USER_STARTUP_FINISHED_STR,
|
||||
"USERSPACE_USEC="USEC_FMT, userspace_usec,
|
||||
LOG_MESSAGE("Startup finished in %s.",
|
||||
format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC)),
|
||||
NULL);
|
||||
format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC)));
|
||||
}
|
||||
|
||||
bus_manager_send_finished(m, firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec);
|
||||
|
@ -2067,8 +2067,7 @@ static void service_enter_restart(Service *s) {
|
||||
LOG_UNIT_ID(UNIT(s)),
|
||||
LOG_UNIT_INVOCATION_ID(UNIT(s)),
|
||||
LOG_UNIT_MESSAGE(UNIT(s), "Scheduled restart job, restart counter is at %u.", s->n_restarts),
|
||||
"N_RESTARTS=%u", s->n_restarts,
|
||||
NULL);
|
||||
"N_RESTARTS=%u", s->n_restarts);
|
||||
|
||||
/* Notify clients about changed restart counter */
|
||||
unit_add_to_dbus_queue(UNIT(s));
|
||||
@ -3065,8 +3064,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
|
||||
"EXIT_CODE=%s", sigchld_code_to_string(code),
|
||||
"EXIT_STATUS=%i", status,
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
NULL);
|
||||
LOG_UNIT_INVOCATION_ID(u));
|
||||
|
||||
if (s->result == SERVICE_SUCCESS)
|
||||
s->result = f;
|
||||
|
@ -400,7 +400,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
|
||||
j->unit->id,
|
||||
unit_id == array ? "ordering cycle" : "dependency",
|
||||
*unit_id, *job_type,
|
||||
unit_ids, NULL);
|
||||
unit_ids);
|
||||
|
||||
if (delete) {
|
||||
const char *status;
|
||||
@ -409,7 +409,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
|
||||
"MESSAGE=%s: Job %s/%s deleted to break ordering cycle starting with %s/%s",
|
||||
j->unit->id, delete->unit->id, job_type_to_string(delete->type),
|
||||
j->unit->id, job_type_to_string(j->type),
|
||||
unit_ids, NULL);
|
||||
unit_ids);
|
||||
|
||||
if (log_get_show_color())
|
||||
status = ANSI_HIGHLIGHT_RED " SKIP " ANSI_NORMAL;
|
||||
@ -425,7 +425,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
|
||||
log_struct(LOG_ERR,
|
||||
"MESSAGE=%s: Unable to break cycle starting with %s/%s",
|
||||
j->unit->id, j->unit->id, job_type_to_string(j->type),
|
||||
unit_ids, NULL);
|
||||
unit_ids);
|
||||
|
||||
return sd_bus_error_setf(e, BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC,
|
||||
"Transaction order is cyclic. See system logs for details.");
|
||||
|
@ -1680,8 +1680,7 @@ static void unit_status_log_starting_stopping_reloading(Unit *u, JobType t) {
|
||||
LOG_MESSAGE("%s", buf),
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
mid,
|
||||
NULL);
|
||||
mid);
|
||||
}
|
||||
|
||||
void unit_status_emit_starting_stopping_reloading(Unit *u, JobType t) {
|
||||
@ -4681,8 +4680,7 @@ void unit_warn_if_dir_nonempty(Unit *u, const char* where) {
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Directory %s to mount over is not empty, mounting anyway.", where),
|
||||
"WHERE=%s", where,
|
||||
NULL);
|
||||
"WHERE=%s", where);
|
||||
}
|
||||
|
||||
int unit_fail_if_noncanonical(Unit *u, const char* where) {
|
||||
@ -4708,8 +4706,7 @@ int unit_fail_if_noncanonical(Unit *u, const char* where) {
|
||||
LOG_UNIT_ID(u),
|
||||
LOG_UNIT_INVOCATION_ID(u),
|
||||
LOG_UNIT_MESSAGE(u, "Mount path %s is not canonical (contains a symlink).", where),
|
||||
"WHERE=%s", where,
|
||||
NULL);
|
||||
"WHERE=%s", where);
|
||||
|
||||
return -ELOOP;
|
||||
}
|
||||
|
@ -384,8 +384,7 @@ static int save_external_coredump(
|
||||
log_struct(LOG_INFO,
|
||||
LOG_MESSAGE("Core file was truncated to %zu bytes.", max_size),
|
||||
"SIZE_LIMIT=%zu", max_size,
|
||||
"MESSAGE_ID=" SD_MESSAGE_TRUNCATED_CORE_STR,
|
||||
NULL);
|
||||
"MESSAGE_ID=" SD_MESSAGE_TRUNCATED_CORE_STR);
|
||||
|
||||
if (fstat(fd, &st) < 0) {
|
||||
log_error_errno(errno, "Failed to fstat core file %s: %m", coredump_tmpfile_name(tmp));
|
||||
|
@ -159,8 +159,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
|
||||
case KEY_POWER2:
|
||||
log_struct(LOG_INFO,
|
||||
LOG_MESSAGE("Power key pressed."),
|
||||
"MESSAGE_ID=" SD_MESSAGE_POWER_KEY_STR,
|
||||
NULL);
|
||||
"MESSAGE_ID=" SD_MESSAGE_POWER_KEY_STR);
|
||||
|
||||
manager_handle_action(b->manager, INHIBIT_HANDLE_POWER_KEY, b->manager->handle_power_key, b->manager->power_key_ignore_inhibited, true);
|
||||
break;
|
||||
@ -174,8 +173,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
|
||||
case KEY_SLEEP:
|
||||
log_struct(LOG_INFO,
|
||||
LOG_MESSAGE("Suspend key pressed."),
|
||||
"MESSAGE_ID=" SD_MESSAGE_SUSPEND_KEY_STR,
|
||||
NULL);
|
||||
"MESSAGE_ID=" SD_MESSAGE_SUSPEND_KEY_STR);
|
||||
|
||||
manager_handle_action(b->manager, INHIBIT_HANDLE_SUSPEND_KEY, b->manager->handle_suspend_key, b->manager->suspend_key_ignore_inhibited, true);
|
||||
break;
|
||||
@ -183,8 +181,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
|
||||
case KEY_SUSPEND:
|
||||
log_struct(LOG_INFO,
|
||||
LOG_MESSAGE("Hibernate key pressed."),
|
||||
"MESSAGE_ID=" SD_MESSAGE_HIBERNATE_KEY_STR,
|
||||
NULL);
|
||||
"MESSAGE_ID=" SD_MESSAGE_HIBERNATE_KEY_STR);
|
||||
|
||||
manager_handle_action(b->manager, INHIBIT_HANDLE_HIBERNATE_KEY, b->manager->handle_hibernate_key, b->manager->hibernate_key_ignore_inhibited, true);
|
||||
break;
|
||||
@ -195,8 +192,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
|
||||
if (ev.code == SW_LID) {
|
||||
log_struct(LOG_INFO,
|
||||
LOG_MESSAGE("Lid closed."),
|
||||
"MESSAGE_ID=" SD_MESSAGE_LID_CLOSED_STR,
|
||||
NULL);
|
||||
"MESSAGE_ID=" SD_MESSAGE_LID_CLOSED_STR);
|
||||
|
||||
b->lid_closed = true;
|
||||
button_lid_switch_handle_action(b->manager, true);
|
||||
@ -205,8 +201,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
|
||||
} else if (ev.code == SW_DOCK) {
|
||||
log_struct(LOG_INFO,
|
||||
LOG_MESSAGE("System docked."),
|
||||
"MESSAGE_ID=" SD_MESSAGE_SYSTEM_DOCKED_STR,
|
||||
NULL);
|
||||
"MESSAGE_ID=" SD_MESSAGE_SYSTEM_DOCKED_STR);
|
||||
|
||||
b->docked = true;
|
||||
}
|
||||
@ -216,8 +211,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
|
||||
if (ev.code == SW_LID) {
|
||||
log_struct(LOG_INFO,
|
||||
LOG_MESSAGE("Lid opened."),
|
||||
"MESSAGE_ID=" SD_MESSAGE_LID_OPENED_STR,
|
||||
NULL);
|
||||
"MESSAGE_ID=" SD_MESSAGE_LID_OPENED_STR);
|
||||
|
||||
b->lid_closed = false;
|
||||
b->check_event_source = sd_event_source_unref(b->check_event_source);
|
||||
@ -225,8 +219,7 @@ static int button_dispatch(sd_event_source *s, int fd, uint32_t revents, void *u
|
||||
} else if (ev.code == SW_DOCK) {
|
||||
log_struct(LOG_INFO,
|
||||
LOG_MESSAGE("System undocked."),
|
||||
"MESSAGE_ID=" SD_MESSAGE_SYSTEM_UNDOCKED_STR,
|
||||
NULL);
|
||||
"MESSAGE_ID=" SD_MESSAGE_SYSTEM_UNDOCKED_STR);
|
||||
|
||||
b->docked = false;
|
||||
}
|
||||
|
@ -1421,8 +1421,7 @@ static int bus_manager_log_shutdown(
|
||||
return log_struct(LOG_NOTICE,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SHUTDOWN_STR,
|
||||
p,
|
||||
q,
|
||||
NULL);
|
||||
q);
|
||||
}
|
||||
|
||||
static int lid_switch_ignore_handler(sd_event_source *e, uint64_t usec, void *userdata) {
|
||||
|
@ -407,8 +407,7 @@ int seat_start(Seat *s) {
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SEAT_START_STR,
|
||||
"SEAT_ID=%s", s->id,
|
||||
LOG_MESSAGE("New seat %s.", s->id),
|
||||
NULL);
|
||||
LOG_MESSAGE("New seat %s.", s->id));
|
||||
|
||||
/* Initialize VT magic stuff */
|
||||
seat_preallocate_vts(s);
|
||||
@ -435,8 +434,7 @@ int seat_stop(Seat *s, bool force) {
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SEAT_STOP_STR,
|
||||
"SEAT_ID=%s", s->id,
|
||||
LOG_MESSAGE("Removed seat %s.", s->id),
|
||||
NULL);
|
||||
LOG_MESSAGE("Removed seat %s.", s->id));
|
||||
|
||||
seat_stop_sessions(s, force);
|
||||
|
||||
|
@ -615,8 +615,7 @@ int session_start(Session *s, sd_bus_message *properties) {
|
||||
"SESSION_ID=%s", s->id,
|
||||
"USER_ID=%s", s->user->name,
|
||||
"LEADER="PID_FMT, s->leader,
|
||||
LOG_MESSAGE("New session %s of user %s.", s->id, s->user->name),
|
||||
NULL);
|
||||
LOG_MESSAGE("New session %s of user %s.", s->id, s->user->name));
|
||||
|
||||
if (!dual_timestamp_is_set(&s->timestamp))
|
||||
dual_timestamp_get(&s->timestamp);
|
||||
@ -731,8 +730,7 @@ int session_finalize(Session *s) {
|
||||
"SESSION_ID=%s", s->id,
|
||||
"USER_ID=%s", s->user->name,
|
||||
"LEADER="PID_FMT, s->leader,
|
||||
LOG_MESSAGE("Removed session %s.", s->id),
|
||||
NULL);
|
||||
LOG_MESSAGE("Removed session %s.", s->id));
|
||||
|
||||
s->timer_event_source = sd_event_source_unref(s->timer_event_source);
|
||||
|
||||
|
@ -395,8 +395,7 @@ int machine_start(Machine *m, sd_bus_message *properties, sd_bus_error *error) {
|
||||
"MESSAGE_ID=" SD_MESSAGE_MACHINE_START_STR,
|
||||
"NAME=%s", m->name,
|
||||
"LEADER="PID_FMT, m->leader,
|
||||
LOG_MESSAGE("New machine %s.", m->name),
|
||||
NULL);
|
||||
LOG_MESSAGE("New machine %s.", m->name));
|
||||
|
||||
if (!dual_timestamp_is_set(&m->timestamp))
|
||||
dual_timestamp_get(&m->timestamp);
|
||||
@ -458,8 +457,7 @@ int machine_finalize(Machine *m) {
|
||||
"MESSAGE_ID=" SD_MESSAGE_MACHINE_STOP_STR,
|
||||
"NAME=%s", m->name,
|
||||
"LEADER="PID_FMT, m->leader,
|
||||
LOG_MESSAGE("Machine %s terminated.", m->name),
|
||||
NULL);
|
||||
LOG_MESSAGE("Machine %s terminated.", m->name));
|
||||
|
||||
machine_unlink(m);
|
||||
machine_add_to_gc_queue(m);
|
||||
|
@ -444,8 +444,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
|
||||
ADDRESS_FMT_VAL(gateway)),
|
||||
"ADDRESS=%u.%u.%u.%u", ADDRESS_FMT_VAL(address),
|
||||
"PREFIXLEN=%u", prefixlen,
|
||||
"GATEWAY=%u.%u.%u.%u", ADDRESS_FMT_VAL(gateway),
|
||||
NULL);
|
||||
"GATEWAY=%u.%u.%u.%u", ADDRESS_FMT_VAL(gateway));
|
||||
else
|
||||
log_struct(LOG_INFO,
|
||||
LOG_LINK_INTERFACE(link),
|
||||
@ -453,8 +452,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
|
||||
ADDRESS_FMT_VAL(address),
|
||||
prefixlen),
|
||||
"ADDRESS=%u.%u.%u.%u", ADDRESS_FMT_VAL(address),
|
||||
"PREFIXLEN=%u", prefixlen,
|
||||
NULL);
|
||||
"PREFIXLEN=%u", prefixlen);
|
||||
|
||||
link->dhcp_lease = sd_dhcp_lease_ref(lease);
|
||||
link_dirty(link);
|
||||
|
@ -2260,17 +2260,14 @@ static int link_enter_join_netdev(Link *link) {
|
||||
log_struct(LOG_DEBUG,
|
||||
LOG_LINK_INTERFACE(link),
|
||||
LOG_NETDEV_INTERFACE(link->network->bond),
|
||||
LOG_LINK_MESSAGE(link, "Enslaving by '%s'", link->network->bond->ifname),
|
||||
NULL);
|
||||
LOG_LINK_MESSAGE(link, "Enslaving by '%s'", link->network->bond->ifname));
|
||||
|
||||
r = netdev_join(link->network->bond, link, netdev_join_handler);
|
||||
if (r < 0) {
|
||||
log_struct_errno(LOG_WARNING, r,
|
||||
LOG_LINK_INTERFACE(link),
|
||||
LOG_NETDEV_INTERFACE(link->network->bond),
|
||||
LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", link->network->bond->ifname),
|
||||
NULL);
|
||||
|
||||
LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", link->network->bond->ifname));
|
||||
link_enter_failed(link);
|
||||
return r;
|
||||
}
|
||||
@ -2282,16 +2279,14 @@ static int link_enter_join_netdev(Link *link) {
|
||||
log_struct(LOG_DEBUG,
|
||||
LOG_LINK_INTERFACE(link),
|
||||
LOG_NETDEV_INTERFACE(link->network->bridge),
|
||||
LOG_LINK_MESSAGE(link, "Enslaving by '%s'", link->network->bridge->ifname),
|
||||
NULL);
|
||||
LOG_LINK_MESSAGE(link, "Enslaving by '%s'", link->network->bridge->ifname));
|
||||
|
||||
r = netdev_join(link->network->bridge, link, netdev_join_handler);
|
||||
if (r < 0) {
|
||||
log_struct_errno(LOG_WARNING, r,
|
||||
LOG_LINK_INTERFACE(link),
|
||||
LOG_NETDEV_INTERFACE(link->network->bridge),
|
||||
LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", link->network->bridge->ifname),
|
||||
NULL),
|
||||
LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", link->network->bridge->ifname));
|
||||
link_enter_failed(link);
|
||||
return r;
|
||||
}
|
||||
@ -2303,15 +2298,14 @@ static int link_enter_join_netdev(Link *link) {
|
||||
log_struct(LOG_DEBUG,
|
||||
LOG_LINK_INTERFACE(link),
|
||||
LOG_NETDEV_INTERFACE(link->network->vrf),
|
||||
LOG_LINK_MESSAGE(link, "Enslaving by '%s'", link->network->vrf->ifname),
|
||||
NULL);
|
||||
LOG_LINK_MESSAGE(link, "Enslaving by '%s'", link->network->vrf->ifname));
|
||||
|
||||
r = netdev_join(link->network->vrf, link, netdev_join_handler);
|
||||
if (r < 0) {
|
||||
log_struct_errno(LOG_WARNING, r,
|
||||
LOG_LINK_INTERFACE(link),
|
||||
LOG_NETDEV_INTERFACE(link->network->vrf),
|
||||
LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", link->network->vrf->ifname),
|
||||
NULL);
|
||||
LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", link->network->vrf->ifname));
|
||||
link_enter_failed(link);
|
||||
return r;
|
||||
}
|
||||
@ -2329,16 +2323,14 @@ static int link_enter_join_netdev(Link *link) {
|
||||
log_struct(LOG_DEBUG,
|
||||
LOG_LINK_INTERFACE(link),
|
||||
LOG_NETDEV_INTERFACE(netdev),
|
||||
LOG_LINK_MESSAGE(link, "Enslaving by '%s'", netdev->ifname),
|
||||
NULL);
|
||||
LOG_LINK_MESSAGE(link, "Enslaving by '%s'", netdev->ifname));
|
||||
|
||||
r = netdev_join(netdev, link, netdev_join_handler);
|
||||
if (r < 0) {
|
||||
log_struct_errno(LOG_WARNING, r,
|
||||
LOG_LINK_INTERFACE(link),
|
||||
LOG_NETDEV_INTERFACE(netdev),
|
||||
LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", netdev->ifname),
|
||||
NULL);
|
||||
LOG_LINK_MESSAGE(link, "Could not join netdev '%s': %m", netdev->ifname));
|
||||
link_enter_failed(link);
|
||||
return r;
|
||||
}
|
||||
|
@ -313,8 +313,7 @@ void dns_transaction_complete(DnsTransaction *t, DnsTransactionState state) {
|
||||
"DNS_QUESTION=%s", key_str,
|
||||
"DNSSEC_RESULT=%s", dnssec_result_to_string(t->answer_dnssec_result),
|
||||
"DNS_SERVER=%s", dns_server_string(t->server),
|
||||
"DNS_SERVER_FEATURE_LEVEL=%s", dns_server_feature_level_to_string(t->server->possible_feature_level),
|
||||
NULL);
|
||||
"DNS_SERVER_FEATURE_LEVEL=%s", dns_server_feature_level_to_string(t->server->possible_feature_level));
|
||||
}
|
||||
|
||||
/* Note that this call might invalidate the query. Callers
|
||||
|
@ -630,9 +630,9 @@ static int dns_trust_anchor_remove_revoked(DnsTrustAnchor *d, DnsResourceRecord
|
||||
/* We found the key! Warn the user */
|
||||
log_struct(LOG_WARNING,
|
||||
"MESSAGE_ID=" SD_MESSAGE_DNSSEC_TRUST_ANCHOR_REVOKED_STR,
|
||||
LOG_MESSAGE("DNSSEC Trust anchor %s has been revoked. Please update the trust anchor, or upgrade your operating system."), strna(dns_resource_record_to_string(rr)),
|
||||
"TRUST_ANCHOR=%s", dns_resource_record_to_string(rr),
|
||||
NULL);
|
||||
LOG_MESSAGE("DNSSEC Trust anchor %s has been revoked. Please update the trust anchor, or upgrade your operating system."),
|
||||
strna(dns_resource_record_to_string(rr)),
|
||||
"TRUST_ANCHOR=%s", dns_resource_record_to_string(rr));
|
||||
|
||||
if (dns_answer_size(new_answer) <= 0) {
|
||||
assert_se(hashmap_remove(d->positive_by_key, rr->key) == old_answer);
|
||||
|
@ -171,8 +171,7 @@ static int execute(char **modes, char **states) {
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SLEEP_START_STR,
|
||||
LOG_MESSAGE("Suspending system..."),
|
||||
"SLEEP=%s", arg_verb,
|
||||
NULL);
|
||||
"SLEEP=%s", arg_verb);
|
||||
|
||||
r = write_state(&f, states);
|
||||
if (r < 0)
|
||||
@ -181,8 +180,7 @@ static int execute(char **modes, char **states) {
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE_ID=" SD_MESSAGE_SLEEP_STOP_STR,
|
||||
LOG_MESSAGE("System resumed."),
|
||||
"SLEEP=%s", arg_verb,
|
||||
NULL);
|
||||
"SLEEP=%s", arg_verb);
|
||||
|
||||
arguments[1] = (char*) "post";
|
||||
execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments);
|
||||
|
@ -29,22 +29,19 @@ assert_cc((LOG_REALM_PLUS_LEVEL(LOG_REALM_UDEV, LOG_USER | LOG_INFO) & LOG_PRIMA
|
||||
static void test_log_console(void) {
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE=Waldo PID="PID_FMT, getpid_cached(),
|
||||
"SERVICE=piepapo",
|
||||
NULL);
|
||||
"SERVICE=piepapo");
|
||||
}
|
||||
|
||||
static void test_log_journal(void) {
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE=Foobar PID="PID_FMT, getpid_cached(),
|
||||
"SERVICE=foobar",
|
||||
NULL);
|
||||
"SERVICE=foobar");
|
||||
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE=Foobar PID="PID_FMT, getpid_cached(),
|
||||
"FORMAT_STR_TEST=1=%i A=%c 2=%hi 3=%li 4=%lli 1=%p foo=%s 2.5=%g 3.5=%g 4.5=%Lg",
|
||||
(int) 1, 'A', (short) 2, (long int) 3, (long long int) 4, (void*) 1, "foo", (float) 2.5f, (double) 3.5, (long double) 4.5,
|
||||
"SUFFIX=GOT IT",
|
||||
NULL);
|
||||
"SUFFIX=GOT IT");
|
||||
}
|
||||
|
||||
static void test_long_lines(void) {
|
||||
|
@ -578,8 +578,7 @@ static int method_set_timezone(sd_bus_message *m, void *userdata, sd_bus_error *
|
||||
"TIMEZONE=%s", c->zone,
|
||||
"TIMEZONE_SHORTNAME=%s", tzname[daylight],
|
||||
"DAYLIGHT=%i", daylight,
|
||||
LOG_MESSAGE("Changed time zone to '%s' (%s).", c->zone, tzname[daylight]),
|
||||
NULL);
|
||||
LOG_MESSAGE("Changed time zone to '%s' (%s).", c->zone, tzname[daylight]));
|
||||
|
||||
(void) sd_bus_emit_properties_changed(sd_bus_message_get_bus(m), "/org/freedesktop/timedate1", "org.freedesktop.timedate1", "Timezone", NULL);
|
||||
|
||||
@ -765,8 +764,7 @@ static int method_set_time(sd_bus_message *m, void *userdata, sd_bus_error *erro
|
||||
log_struct(LOG_INFO,
|
||||
"MESSAGE_ID=" SD_MESSAGE_TIME_CHANGE_STR,
|
||||
"REALTIME="USEC_FMT, timespec_load(&ts),
|
||||
LOG_MESSAGE("Changed local time to %s", ctime(&ts.tv_sec)),
|
||||
NULL);
|
||||
LOG_MESSAGE("Changed local time to %s", ctime(&ts.tv_sec)));
|
||||
|
||||
return sd_bus_reply_method_return(m, NULL);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user