X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fsnapshot.c;h=900d0d793a24a36f752d23a1694cfeded694aac7;hb=a2c0e528b8b5ba370527db279605e4e4135689c1;hp=d914af20e7c0651f1301fa8be1d7874c249c1119;hpb=f78e6385dc4cee0a1f399c4c89ebf823c108d447;p=elogind.git diff --git a/src/core/snapshot.c b/src/core/snapshot.c index d914af20e..900d0d793 100644 --- a/src/core/snapshot.c +++ b/src/core/snapshot.c @@ -51,10 +51,11 @@ static void snapshot_set_state(Snapshot *s, SnapshotState state) { s->state = state; if (state != old_state) - log_debug("%s changed %s -> %s", - UNIT(s)->id, - snapshot_state_to_string(old_state), - snapshot_state_to_string(state)); + log_unit_debug(UNIT(s)->id, + "%s changed %s -> %s", + UNIT(s)->id, + snapshot_state_to_string(old_state), + snapshot_state_to_string(state)); unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], true); } @@ -154,7 +155,7 @@ static int snapshot_deserialize_item(Unit *u, const char *key, const char *value state = snapshot_state_from_string(value); if (state < 0) - log_debug("Failed to parse state value %s", value); + log_unit_debug(u->id, "Failed to parse state value %s", value); else s->deserialized_state = state; @@ -162,7 +163,7 @@ static int snapshot_deserialize_item(Unit *u, const char *key, const char *value r = parse_boolean(value); if (r < 0) - log_debug("Failed to parse cleanup value %s", value); + log_unit_debug(u->id, "Failed to parse cleanup value %s", value); else s->cleanup = r; @@ -172,7 +173,7 @@ static int snapshot_deserialize_item(Unit *u, const char *key, const char *value if (r < 0) return r; } else - log_debug("Unknown serialization key '%s'", key); + log_unit_debug(u->id, "Unknown serialization key '%s'", key); return 0; } @@ -207,7 +208,7 @@ int snapshot_create(Manager *m, const char *name, bool cleanup, sd_bus_error *e, return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, "Unit name %s lacks snapshot suffix.", name); if (manager_get_unit(m, name)) - sd_bus_error_setf(e, BUS_ERROR_UNIT_EXISTS, "Snapshot %s exists already.", name); + return sd_bus_error_setf(e, BUS_ERROR_UNIT_EXISTS, "Snapshot %s exists already.", name); } else { @@ -257,6 +258,8 @@ int snapshot_create(Manager *m, const char *name, bool cleanup, sd_bus_error *e, SNAPSHOT(u)->cleanup = cleanup; *_s = SNAPSHOT(u); + log_unit_info(u->id, "Created snapshot %s.", u->id); + return 0; fail: @@ -269,6 +272,8 @@ fail: void snapshot_remove(Snapshot *s) { assert(s); + log_unit_info(UNIT(s)->id, "Removing snapshot %s.", UNIT(s)->id); + unit_add_to_cleanup_queue(UNIT(s)); }