diff options
-rw-r--r-- | src/resolve/resolvectl.c | 8 | ||||
-rw-r--r-- | src/resolve/resolved-bus.c | 58 |
2 files changed, 9 insertions, 57 deletions
diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c index 831901e9b4..8abaeb5f1c 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c @@ -2529,8 +2529,8 @@ static int verb_log_level(int argc, char *argv[], void *userdata) { r = sd_bus_get_property_string( bus, "org.freedesktop.resolve1", - "/org/freedesktop/resolve1", - "org.freedesktop.resolve1.Manager", + "/org/freedesktop/LogControl1", + "org.freedesktop.LogControl1", "LogLevel", &error, &level); @@ -2545,8 +2545,8 @@ static int verb_log_level(int argc, char *argv[], void *userdata) { r = sd_bus_set_property( bus, "org.freedesktop.resolve1", - "/org/freedesktop/resolve1", - "org.freedesktop.resolve1.Manager", + "/org/freedesktop/LogControl1", + "org.freedesktop.LogControl1", "LogLevel", &error, "s", diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c index badb0ee739..f56166b94c 100644 --- a/src/resolve/resolved-bus.c +++ b/src/resolve/resolved-bus.c @@ -2,6 +2,7 @@ #include "alloc-util.h" #include "bus-common-errors.h" +#include "bus-log-control-api.h" #include "bus-polkit.h" #include "bus-util.h" #include "dns-domain.h" @@ -1836,57 +1837,6 @@ static int bus_method_unregister_service(sd_bus_message *message, void *userdata return call_dnssd_method(m, message, bus_dnssd_method_unregister, error); } -static int property_get_log_level( - sd_bus *bus, - const char *path, - const char *interface, - const char *property, - sd_bus_message *reply, - void *userdata, - sd_bus_error *error) { - - _cleanup_free_ char *t = NULL; - int r; - - assert(bus); - assert(reply); - - r = log_level_to_string_alloc(log_get_max_level(), &t); - if (r < 0) - return r; - - return sd_bus_message_append(reply, "s", t); -} - -static int property_set_log_level( - sd_bus *bus, - const char *path, - const char *interface, - const char *property, - sd_bus_message *value, - void *userdata, - sd_bus_error *error) { - - const char *t; - int r; - - assert(bus); - assert(value); - - r = sd_bus_message_read(value, "s", &t); - if (r < 0) - return r; - - r = log_level_from_string(t); - if (r < 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid log level '%s'", t); - - log_info("Setting log level to %s.", t); - log_set_max_level(r); - - return 0; -} - static const sd_bus_vtable resolve_vtable[] = { SD_BUS_VTABLE_START(0), SD_BUS_PROPERTY("LLMNRHostname", "s", NULL, offsetof(Manager, llmnr_hostname), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), @@ -1905,8 +1855,6 @@ static const sd_bus_vtable resolve_vtable[] = { SD_BUS_PROPERTY("DNSSECNegativeTrustAnchors", "as", bus_property_get_ntas, 0, 0), SD_BUS_PROPERTY("DNSStubListener", "s", bus_property_get_dns_stub_listener_mode, offsetof(Manager, dns_stub_listener_mode), 0), - SD_BUS_WRITABLE_PROPERTY("LogLevel", "s", property_get_log_level, property_set_log_level, 0, 0), - SD_BUS_METHOD_WITH_NAMES("ResolveHostname", "isit", SD_BUS_PARAM(ifindex) @@ -2121,6 +2069,10 @@ int manager_connect_bus(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to register dnssd enumerator: %m"); + r = bus_log_control_api_register(m->bus); + if (r < 0) + return r; + r = sd_bus_request_name_async(m->bus, NULL, "org.freedesktop.resolve1", 0, NULL, NULL); if (r < 0) return log_error_errno(r, "Failed to request name: %m"); |