Replace wlr_log with sway_log

This commit mostly duplicates the wlr_log functions, although
with a sway_* prefix. (This is very similar to PR #2009.)
However, the logging function no longer needs to be replaceable,
so sway_log_init's second argument is used to set the exit
callback for sway_abort.

wlr_log_init is still invoked in sway/main.c

This commit makes it easier to remove the wlroots dependency for
the helper programs swaymsg, swaybg, swaybar, and swaynag.
This commit is contained in:
M Stoeckl 2019-01-20 13:51:12 -05:00 committed by emersion
parent 5c834d36e1
commit 1211a81aad
108 changed files with 613 additions and 504 deletions

View file

@ -17,7 +17,7 @@ static int handle_lost_watcher(sd_bus_message *msg,
char *service, *old_owner, *new_owner;
int ret = sd_bus_message_read(msg, "sss", &service, &old_owner, &new_owner);
if (ret < 0) {
wlr_log(WLR_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
sway_log(SWAY_ERROR, "Failed to parse owner change message: %s", strerror(-ret));
return ret;
}
@ -34,12 +34,12 @@ static int handle_lost_watcher(sd_bus_message *msg,
}
struct swaybar_tray *create_tray(struct swaybar *bar) {
wlr_log(WLR_DEBUG, "Initializing tray");
sway_log(SWAY_DEBUG, "Initializing tray");
sd_bus *bus;
int ret = sd_bus_open_user(&bus);
if (ret < 0) {
wlr_log(WLR_ERROR, "Failed to connect to user bus: %s", strerror(-ret));
sway_log(SWAY_ERROR, "Failed to connect to user bus: %s", strerror(-ret));
return NULL;
}
@ -58,7 +58,7 @@ struct swaybar_tray *create_tray(struct swaybar *bar) {
"/org/freedesktop/DBus", "org.freedesktop.DBus",
"NameOwnerChanged", handle_lost_watcher, tray);
if (ret < 0) {
wlr_log(WLR_ERROR, "Failed to subscribe to unregistering events: %s",
sway_log(SWAY_ERROR, "Failed to subscribe to unregistering events: %s",
strerror(-ret));
}
@ -96,7 +96,7 @@ void tray_in(int fd, short mask, void *data) {
// This space intentionally left blank
}
if (ret < 0) {
wlr_log(WLR_ERROR, "Failed to process bus: %s", strerror(-ret));
sway_log(SWAY_ERROR, "Failed to process bus: %s", strerror(-ret));
}
}