diff mbox series

[v1,05/30] lib/log: Switch to pb_log_fn

Message ID b798e2161a2551ae6cb6ed9765736aee44f0b719.1532469861.git.geoff@infradead.org
State Superseded
Headers show
Series [v1,01/30] docker: Add libfdt-dev | expand

Commit Message

Geoff Levand July 24, 2018, 10:15 p.m. UTC
The only functional change should be an additional '/n' to
a few log messagees that seemed to be missing it.

Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 discover/boot.c               | 14 +++++++-------
 discover/device-handler.c     |  8 ++++----
 discover/devmapper.c          | 14 +++++++-------
 discover/discover-server.c    |  6 +++---
 discover/event.c              |  8 ++++----
 discover/ipmi.c               |  2 +-
 discover/platform-powerpc.c   |  4 ++--
 discover/pxe-parser.c         |  2 +-
 discover/resource.c           |  2 +-
 discover/udev.c               |  4 ++--
 discover/user-event.c         | 16 ++++++++--------
 lib/file/file.c               |  6 +++---
 lib/flash/flash.c             |  8 ++++----
 lib/pb-protocol/pb-protocol.c |  8 ++++----
 lib/process/process.c         | 12 ++++++------
 lib/security/common.c         |  2 +-
 lib/security/gpg.c            | 26 +++++++++++++-------------
 lib/security/openssl.c        | 18 +++++++++---------
 lib/url/url.c                 |  2 +-
 ui/common/discover-client.c   | 20 ++++++++++----------
 ui/common/joystick.c          |  4 ++--
 ui/common/ps3.c               | 18 +++++++++---------
 ui/common/timer.c             |  2 +-
 ui/common/ui-system.c         |  2 +-
 ui/ncurses/generic-main.c     |  2 +-
 ui/ncurses/nc-cui.c           | 36 ++++++++++++++++++------------------
 ui/ncurses/nc-menu.c          |  8 ++++----
 ui/ncurses/ps3-main.c         |  8 ++++----
 ui/twin/main-generic.c        |  4 ++--
 ui/twin/main-ps3.c            |  2 +-
 ui/twin/pbt-client.c          | 12 ++++++------
 ui/twin/pbt-scr.c             | 16 ++++++++--------
 32 files changed, 148 insertions(+), 148 deletions(-)
diff mbox series

Patch

diff --git a/discover/boot.c b/discover/boot.c
index 2a0d333..06df075 100644
--- a/discover/boot.c
+++ b/discover/boot.c
@@ -94,7 +94,7 @@  static int kexec_load(struct boot_task *boot_task)
 
 	process = process_create(boot_task);
 	if (!process) {
-		pb_log("%s: failed to create process\n", __func__);
+		pb_log_fn("failed to create process\n");
 		return -1;
 	}
 
@@ -131,14 +131,14 @@  static int kexec_load(struct boot_task *boot_task)
 
 	result = process_run_sync(process);
 	if (result) {
-		pb_log("%s: failed to run process\n", __func__);
+		pb_log_fn("failed to run process\n");
 		goto abort_kexec;
 	}
 
 	result = process->exit_status;
 
 	if (result) {
-		pb_log("%s: failed: (%d)\n", __func__, result);
+		pb_log_fn("failed: (%d)\n", result);
 		update_status(boot_task->status_fn, boot_task->status_arg,
 				STATUS_ERROR, "%s", process->stdout_buf);
 	}
@@ -170,7 +170,7 @@  static int kexec_reboot(struct boot_task *task)
 	}
 
 	if (result)
-		pb_log("%s: failed: (%d)\n", __func__, result);
+		pb_log_fn("failed: (%d)\n", result);
 
 	/* okay, kexec -e -f */
 	if (result) {
@@ -179,7 +179,7 @@  static int kexec_reboot(struct boot_task *task)
 	}
 
 	if (result)
-		pb_log("%s: failed: (%d)\n", __func__, result);
+		pb_log_fn("failed: (%d)\n", result);
 
 
 	return result;
@@ -421,7 +421,7 @@  static void boot_process(struct load_url_result *result, void *data)
 			_("Performing kexec load"));
 
 	rc = kexec_load(task);
-	pb_log("%s: kexec_load returned %d\n", __func__, rc);
+	pb_log_fn("kexec_load returned %d\n", rc);
 	if (rc == KEXEC_LOAD_DECRYPTION_FALURE) {
 		update_status(task->status_fn, task->status_arg,
 				STATUS_ERROR, _("Decryption failed"));
@@ -520,7 +520,7 @@  struct boot_task *boot(void *ctx, struct discover_boot_option *opt,
 	} else if (opt && opt->boot_image) {
 		image = opt->boot_image->url;
 	} else {
-		pb_log("%s: no image specified\n", __func__);
+		pb_log_fn("no image specified\n");
 		update_status(status_fn, status_arg, STATUS_INFO,
 				_("Boot failed: no image specified"));
 		return NULL;
diff --git a/discover/device-handler.c b/discover/device-handler.c
index 72dda75..f24f948 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -675,7 +675,7 @@  void device_handler_status_download(struct device_handler *handler,
 	}
 
 	if (!update) {
-		pb_log("%s: failed to allocate new status\n", __func__);
+		pb_log_fn("failed to allocate new status\n");
 	} else {
 		device_handler_status_info(handler, "%s\n", update);
 		talloc_free(update);
@@ -1551,7 +1551,7 @@  static void process_url_cb(struct load_url_result *result, void *data)
 	const char *mac;
 
 	if (result->status != LOAD_OK) {
-		pb_log("%s: Load failed for %s\n", __func__, result->url->full);
+		pb_log_fn("Load failed for %s\n", result->url->full);
 		return;
 	}
 
@@ -1656,7 +1656,7 @@  static void plugin_install_cb(struct process *process)
 	struct device_handler *handler = process->data;
 
 	if (!handler) {
-		pb_log("%s: Missing data!\n", __func__);
+		pb_log_fn("Missing data!\n");
 		return;
 	}
 
@@ -2189,7 +2189,7 @@  void device_handler_discover_context_commit(
 		struct device_handler *handler __attribute__((unused)),
 		struct discover_context *ctx __attribute__((unused)))
 {
-	pb_log("%s stubbed out for test cases\n", __func__);
+	pb_log_fn("stubbed out for test cases\n");
 }
 
 static void device_handler_update_lang(const char *lang __attribute__((unused)))
diff --git a/discover/devmapper.c b/discover/devmapper.c
index d8445e6..f7407b7 100644
--- a/discover/devmapper.c
+++ b/discover/devmapper.c
@@ -138,7 +138,7 @@  static bool snapshot_merge_complete(const char *dm_name)
 
 	task = dm_task_create(DM_DEVICE_STATUS);
 	if (!task) {
-		pb_log("%s: Error creating task\n", __func__);
+		pb_log_fn("Error creating task\n");
 		return result;
 	}
 
@@ -198,7 +198,7 @@  static int set_device_active(const char *dm_name, bool active)
 		task = dm_task_create(DM_DEVICE_SUSPEND);
 
 	if (!task) {
-		pb_log("%s: Could not create dm_task\n", __func__);
+		pb_log_fn("Could not create dm_task\n");
 		return rc;
 	}
 
@@ -461,7 +461,7 @@  static int destroy_device(const char *dm_name)
 
 	task = dm_task_create(DM_DEVICE_REMOVE);
 	if (!task) {
-		pb_log("%s: could not create dm_task\n", __func__);
+		pb_log_fn("could not create dm_task\n");
 		return -1;
 	}
 
@@ -543,13 +543,13 @@  static int reload_snapshot(struct discover_device *device, bool merge)
 			 device->ramdisk->base);
 	}
 	if (!target.ttype || !target.params) {
-		pb_log("%s: failed to allocate parameters\n", __func__);
+		pb_log_fn("failed to allocate parameters\n");
 		goto err1;
 	}
 
 	task = dm_task_create(DM_DEVICE_RELOAD);
 	if (!task) {
-		pb_log("%s: Error creating task\n", __func__);
+		pb_log_fn("Error creating task\n");
 		goto err1;
 	}
 
@@ -560,7 +560,7 @@  static int reload_snapshot(struct discover_device *device, bool merge)
 
 	if (!dm_task_add_target(task, target.start_sector, target.end_sector,
 				target.ttype, target.params)) {
-		pb_log("%s: Failed to set target\n", __func__);
+		pb_log_fn("Failed to set target\n");
 		goto err2;
 	}
 
@@ -581,7 +581,7 @@  err1:
 int devmapper_merge_snapshot(struct discover_device *device)
 {
 	if (device->mounted) {
-		pb_log("%s: %s still mounted\n", __func__, device->device->id);
+		pb_log_fn("%s still mounted\n", device->device->id);
 		return -1;
 	}
 
diff --git a/discover/discover-server.c b/discover/discover-server.c
index 3377fa6..34d82be 100644
--- a/discover/discover-server.c
+++ b/discover/discover-server.c
@@ -270,7 +270,7 @@  static int discover_server_process_message(void *arg)
 		rc = pb_protocol_deserialise_boot_command(boot_command,
 				message);
 		if (rc) {
-			pb_log("%s: no boot command?", __func__);
+			pb_log_fn("no boot command?\n");
 			return 0;
 		}
 
@@ -291,7 +291,7 @@  static int discover_server_process_message(void *arg)
 
 		rc = pb_protocol_deserialise_config(config, message);
 		if (rc) {
-			pb_log("%s: no config?", __func__);
+			pb_log_fn("no config?\n");
 			return 0;
 		}
 
@@ -328,7 +328,7 @@  static int discover_server_process_message(void *arg)
 		break;
 
 	default:
-		pb_log("%s: invalid action %d\n", __func__, message->action);
+		pb_log_fn("invalid action %d\n", message->action);
 		return 0;
 	}
 
diff --git a/discover/event.c b/discover/event.c
index 047e928..ead2fda 100644
--- a/discover/event.c
+++ b/discover/event.c
@@ -29,14 +29,14 @@  static int event_parse_ad_header(char *buf, int len, enum event_action *action,
 	headerlen = strnlen(buf, len);
 
 	if (!headerlen) {
-		pb_log("%s: bad header, no data\n", __func__);
+		pb_log_fn("bad header, no data\n");
 		return -1;
 	}
 
 	/* we should see an <action>@<device>\0 at the head of the buffer */
 	sep = strchr(buf, '@');
 	if (!sep) {
-		pb_log("%s: bad header: %s\n", __func__, buf);
+		pb_log_fn("bad header: %s\n", buf);
 		return -1;
 	}
 
@@ -58,12 +58,12 @@  static int event_parse_ad_header(char *buf, int len, enum event_action *action,
 	else if (streq(buf, "plugin"))
 		*action = EVENT_ACTION_PLUGIN;
 	else {
-		pb_log("%s: unknown action: %s\n", __func__, buf);
+		pb_log_fn("unknown action: %s\n", buf);
 		return -1;
 	}
 
 	if (!*(sep + 1)) {
-		pb_log("%s: bad device: %s\n", __func__, buf);
+		pb_log_fn("bad device: %s\n", buf);
 		return -1;
 	}
 
diff --git a/discover/ipmi.c b/discover/ipmi.c
index d652e9f..f94dab7 100644
--- a/discover/ipmi.c
+++ b/discover/ipmi.c
@@ -239,7 +239,7 @@  int parse_ipmi_interface_override(struct config *config, uint8_t *buf,
 	i += sizeof(ipsize);
 
 	if (!hwsize || !ipsize) {
-		pb_log("%s: Empty response\n", __func__);
+		pb_log_fn("Empty response\n");
 		return -1;
 	}
 
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index df8c7d6..22d213d 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -1193,7 +1193,7 @@  static void get_ipmi_network_override(struct platform_powerpc *platform,
 	memcpy(&cookie, &resp[i], sizeof(cookie));
 	cookie = __be32_to_cpu(cookie);
 	if (cookie != magic_value) {
-		pb_log("%s: Incorrect cookie %x\n", __func__, cookie);
+		pb_log_fn("Incorrect cookie %x\n", cookie);
 		return;
 	}
 	i += sizeof(cookie);
@@ -1259,7 +1259,7 @@  static int load_config(struct platform *p, struct config *config)
 
 	rc = parse_nvram(platform);
 	if (rc)
-		pb_log("%s: Failed to parse nvram\n", __func__);
+		pb_log_fn("Failed to parse nvram\n");
 
 	populate_config(platform, config);
 
diff --git a/discover/pxe-parser.c b/discover/pxe-parser.c
index 470dd83..58c7c55 100644
--- a/discover/pxe-parser.c
+++ b/discover/pxe-parser.c
@@ -408,7 +408,7 @@  static int pxe_parse(struct discover_context *dc)
 			file_url = dc->conf_url;
 
 		if (!file_url) {
-			pb_log("%s: Failed to parse conf url!\n", __func__);
+			pb_log_fn("Failed to parse conf url!\n");
 			goto out_conf;
 		}
 
diff --git a/discover/resource.c b/discover/resource.c
index 04e14cb..c09c1c5 100644
--- a/discover/resource.c
+++ b/discover/resource.c
@@ -86,7 +86,7 @@  struct resource *create_devpath_resource(struct discover_boot_option *opt,
 	devstr = talloc_strndup(res, devpath, pos - devpath);
 	path = talloc_strdup(res, pos + 1);
 
-	pb_log("%s: resource depends on device %s\n", __func__, devstr);
+	pb_log_fn("resource depends on device %s\n", devstr);
 
 	/* defer resolution until we can find a suitable matching device */
 	info = talloc(res, struct devpath_resource_info);
diff --git a/discover/udev.c b/discover/udev.c
index 883313b..fa5d4b4 100644
--- a/discover/udev.c
+++ b/discover/udev.c
@@ -81,11 +81,11 @@  static void udev_setup_device_params(struct udev_device *udev,
 static void lvm_vg_search(struct device_handler *handler)
 {
 	if (process_run_simple(handler, pb_system_apps.vgscan, "-qq", NULL))
-		pb_log("%s: Failed to execute vgscan\n", __func__);
+		pb_log_fn("Failed to execute vgscan\n");
 
 	if (process_run_simple(handler, pb_system_apps.vgchange, "-ay", "-qq",
 				NULL))
-		pb_log("%s: Failed to execute vgchange\n", __func__);
+		pb_log_fn("Failed to execute vgchange\n");
 }
 
 static int udev_handle_block_add(struct pb_udev *udev, struct udev_device *dev,
diff --git a/discover/user-event.c b/discover/user-event.c
index 7f63d43..22d6fde 100644
--- a/discover/user-event.c
+++ b/discover/user-event.c
@@ -94,13 +94,13 @@  static struct resource *user_event_resource(struct discover_boot_option *opt,
 
 	siaddr = event_get_param(event, "siaddr");
 	if (!siaddr) {
-		pb_log("%s: next server option not found\n", __func__);
+		pb_log_fn("next server option not found\n");
 		return NULL;
 	}
 
 	boot_file = event_get_param(event, "bootfile");
 	if (!boot_file) {
-		pb_log("%s: bootfile not found\n", __func__);
+		pb_log_fn("bootfile not found\n");
 		return NULL;
 	}
 
@@ -148,7 +148,7 @@  static int parse_user_event(struct discover_context *ctx, struct event *event)
 	val = event_get_param(event, "name");
 
 	if (!val) {
-		pb_log("%s: no name found\n", __func__);
+		pb_log_fn("no name found\n");
 		goto fail_opt;
 	}
 
@@ -157,7 +157,7 @@  static int parse_user_event(struct discover_context *ctx, struct event *event)
 
 	d_opt->boot_image = user_event_resource(d_opt, event, false);
 	if (!d_opt->boot_image) {
-		pb_log("%s: no boot image found for %s!\n", __func__,
+		pb_log_fn("no boot image found for %s!\n",
 				opt->name);
 		goto fail_opt;
 	}
@@ -287,7 +287,7 @@  struct pb_url *user_event_parse_conf_url(struct discover_context *ctx,
 
 	host = parse_host_addr(event);
 	if (!host) {
-		pb_log("%s: host address not found\n", __func__);
+		pb_log_fn("host address not found\n");
 		return NULL;
 	}
 
@@ -355,7 +355,7 @@  char **user_event_parse_conf_filenames(
 	}
 
 	if (!mac_addr && !ip_hex) {
-		pb_log("%s: neither mac nor ip parameter found\n", __func__);
+		pb_log_fn("neither mac nor ip parameter found\n");
 		return NULL;
 	}
 
@@ -659,12 +659,12 @@  static int user_event_process(void *arg)
 	len = recvfrom(uev->socket, buf, PBOOT_USER_EVENT_SIZE, 0, NULL, NULL);
 
 	if (len < 0) {
-		pb_log("%s: socket read failed: %s", __func__, strerror(errno));
+		pb_log_fn("socket read failed: %s\n", strerror(errno));
 		return 0;
 	}
 
 	if (len == 0) {
-		pb_log("%s: empty", __func__);
+		pb_log_fn("empty\n");
 		return 0;
 	}
 
diff --git a/lib/file/file.c b/lib/file/file.c
index b575d34..6028005 100644
--- a/lib/file/file.c
+++ b/lib/file/file.c
@@ -54,13 +54,13 @@  int copy_file_secure_dest(void *ctx, const char *source_file,
 
 	destination_fd = mkstemp(template);
 	if (destination_fd < 0) {
-		pb_log("%s: unable to create temp file, %m\n", __func__);
+		pb_log_fn("unable to create temp file, %m\n");
 		fclose(source_handle);
 		return -1;
 	}
 	destination_handle = fdopen(destination_fd, "w");
 	if (!destination_handle) {
-		pb_log("%s: unable to open destination file, %m\n", __func__);
+		pb_log_fn("unable to open destination file, %m\n");
 		fclose(source_handle);
 		close(destination_fd);
 		return -1;
@@ -81,7 +81,7 @@  int copy_file_secure_dest(void *ctx, const char *source_file,
 			if (ferror(destination_handle)) {
 				/* General error */
 				result = -1;
-				pb_log("%s: failed: unknown fault\n", __func__);
+				pb_log_fn("failed: unknown fault\n");
 			}
 			else {
 				/* No space on destination device */
diff --git a/lib/flash/flash.c b/lib/flash/flash.c
index 464b876..b7e5b88 100644
--- a/lib/flash/flash.c
+++ b/lib/flash/flash.c
@@ -94,7 +94,7 @@  static struct flash_info *flash_setup_buffer(void *ctx, const char *partition)
 
 	rc = ffs_init(0, info->size, info->bl, &info->ffs, 1);
 	if (rc) {
-		pb_log("%s: Failed to init ffs\n", __func__);
+		pb_log_fn("Failed to init ffs\n");
 		goto out_flash;
 	}
 
@@ -171,7 +171,7 @@  int flash_parse_version(void *ctx, char ***versions, bool current)
 	len = cur_info->attr_data_len -  ecc_size(cur_info->attr_data_len);
 	buffer = talloc_array(cur_info, char, len);
 	if (!buffer) {
-		pb_log("%s: Failed to init buffer!\n", __func__);
+		pb_log_fn("Failed to init buffer!\n");
 		goto out;
 	}
 
@@ -187,7 +187,7 @@  int flash_parse_version(void *ctx, char ***versions, bool current)
 	if (tok) {
 		tmp = talloc_realloc(ctx, tmp, char *, n + 1);
 		if (!tmp) {
-			pb_log("%s: Failed to allocate memory\n", __func__);
+			pb_log_fn("Failed to allocate memory\n");
 			goto out;
 		}
 		tmp[n++] = talloc_strdup(ctx, tok);
@@ -198,7 +198,7 @@  int flash_parse_version(void *ctx, char ***versions, bool current)
 		/* Ignore leading tab from subsequent lines */
 		tmp = talloc_realloc(ctx, tmp, char *, n + 1);
 		if (!tmp) {
-			pb_log("%s: Failed to reallocate memory\n", __func__);
+			pb_log_fn("Failed to reallocate memory\n");
 			n = 0;
 			goto out;
 		}
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index 8e37348..be8077e 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -723,7 +723,7 @@  int pb_protocol_write_message(int fd, struct pb_protocol_message *message)
 	if (!total_len)
 		return 0;
 
-	pb_log("%s: failed: %s\n", __func__, strerror(errno));
+	pb_log_fn("failed: %s\n", strerror(errno));
 	return -1;
 }
 
@@ -733,7 +733,7 @@  struct pb_protocol_message *pb_protocol_create_message(void *ctx,
 	struct pb_protocol_message *message;
 
 	if (payload_len > PB_PROTOCOL_MAX_PAYLOAD_SIZE) {
-		pb_log("%s: payload too big %u/%u\n", __func__, payload_len,
+		pb_log_fn("payload too big %u/%u\n", payload_len,
 			PB_PROTOCOL_MAX_PAYLOAD_SIZE);
 		return NULL;
 	}
@@ -764,7 +764,7 @@  struct pb_protocol_message *pb_protocol_read_message(void *ctx, int fd)
 	m.action = __be32_to_cpu(m.action);
 
 	if (m.payload_len > PB_PROTOCOL_MAX_PAYLOAD_SIZE) {
-		pb_log("%s: payload too big %u/%u\n", __func__, m.payload_len,
+		pb_log_fn("payload too big %u/%u\n", m.payload_len,
 			PB_PROTOCOL_MAX_PAYLOAD_SIZE);
 		return NULL;
 	}
@@ -777,7 +777,7 @@  struct pb_protocol_message *pb_protocol_read_message(void *ctx, int fd)
 
 		if (rc <= 0) {
 			talloc_free(message);
-			pb_log("%s: failed (%u): %s\n", __func__, len,
+			pb_log_fn("failed (%u): %s\n", len,
 				strerror(errno));
 			return NULL;
 		}
diff --git a/lib/process/process.c b/lib/process/process.c
index c1606a5..1fa0bb0 100644
--- a/lib/process/process.c
+++ b/lib/process/process.c
@@ -92,7 +92,7 @@  static int process_read_stdout_once(struct process_info *procinfo, char **line)
 	if (rc < 0) {
 		if (errno == EINTR)
 			return 1;
-		pb_log("%s: read failed: %s\n", __func__, strerror(errno));
+		pb_log_fn("read failed: %s\n", strerror(errno));
 		return rc;
 	}
 
@@ -232,7 +232,7 @@  static void sigchld_sigaction(int signo, siginfo_t *info,
 
 	rc = write(procset->sigchld_pipe[1], &pid, sizeof(pid));
 	if (rc != sizeof(pid))
-		pb_log("%s: write failed: %s\n", __func__, strerror(errno));
+		pb_log_fn("write failed: %s\n", strerror(errno));
 }
 
 static int sigchld_pipe_event(void *arg)
@@ -306,7 +306,7 @@  struct procset *process_init(void *ctx, struct waitset *set, bool dry_run)
 
 	rc = pipe(procset->sigchld_pipe);
 	if (rc) {
-		pb_log("%s: pipe() failed: %s\n", __func__, strerror(errno));
+		pb_log_fn("pipe() failed: %s\n", strerror(errno));
 		goto err_free;
 	}
 
@@ -322,7 +322,7 @@  struct procset *process_init(void *ctx, struct waitset *set, bool dry_run)
 
 	rc = sigaction(SIGCHLD, &sa, NULL);
 	if (rc) {
-		pb_log("%s: sigaction() failed: %s\n", __func__,
+		pb_log_fn("sigaction() failed: %s\n",
 				strerror(errno));
 		goto err_remove;
 	}
@@ -374,7 +374,7 @@  static int process_run_common(struct process_info *procinfo)
 
 	pid = fork();
 	if (pid < 0) {
-		pb_log("%s: fork failed: %s\n", __func__, strerror(errno));
+		pb_log_fn("fork failed: %s\n", strerror(errno));
 		return pid;
 	}
 
@@ -410,7 +410,7 @@  int process_run_sync(struct process *process)
 		if (errno == EINTR)
 			continue;
 
-		pb_log("%s: waitpid failed: %s\n", __func__, strerror(errno));
+		pb_log_fn("waitpid failed: %s\n", strerror(errno));
 		return rc;
 	}
 
diff --git a/lib/security/common.c b/lib/security/common.c
index df04054..a93ee98 100644
--- a/lib/security/common.c
+++ b/lib/security/common.c
@@ -81,7 +81,7 @@  int validate_boot_files(struct boot_task *boot_task) {
     /* Load authorized signatures file */
     authorized_signatures_handle = fopen(LOCKDOWN_FILE, "r");
     if (!authorized_signatures_handle) {
-        pb_log("%s: unable to read lockdown file\n", __func__);
+        pb_log_fn("unable to read lockdown file\n");
         return KEXEC_LOAD_SIG_SETUP_INVALID;
     }
 
diff --git a/lib/security/gpg.c b/lib/security/gpg.c
index aae85aa..e319a06 100644
--- a/lib/security/gpg.c
+++ b/lib/security/gpg.c
@@ -73,22 +73,22 @@  int decrypt_file(const char *filename,
 	gpgme_set_locale(NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
 	err = gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP);
 	if (err != GPG_ERR_NO_ERROR) {
-		pb_log("%s: OpenPGP support not available\n", __func__);
+		pb_log_fn("OpenPGP support not available\n");
 		return -1;
 	}
 	err = gpgme_get_engine_info(&enginfo);
 	if (err != GPG_ERR_NO_ERROR) {
-		pb_log("%s: GPG engine failed to initialize\n", __func__);
+		pb_log_fn("GPG engine failed to initialize\n");
 		return -1;
 	}
 	err = gpgme_new(&gpg_context);
 	if (err != GPG_ERR_NO_ERROR) {
-		pb_log("%s: GPG context could not be created\n", __func__);
+		pb_log_fn("GPG context could not be created\n");
 		return -1;
 	}
 	err = gpgme_set_protocol(gpg_context, GPGME_PROTOCOL_OpenPGP);
 	if (err != GPG_ERR_NO_ERROR) {
-		pb_log("%s: GPG protocol could not be set\n", __func__);
+		pb_log_fn("GPG protocol could not be set\n");
 		return -1;
 	}
 	if (keyring_path)
@@ -100,7 +100,7 @@  int decrypt_file(const char *filename,
 			GPGME_PROTOCOL_OpenPGP,
 			enginfo->file_name, enginfo->home_dir);
 	if (err != GPG_ERR_NO_ERROR) {
-		pb_log("%s: Could not set GPG engine information\n", __func__);
+		pb_log_fn("Could not set GPG engine information\n");
 		return -1;
 	}
 	err = gpgme_data_new(&plaintext_data);
@@ -120,7 +120,7 @@  int decrypt_file(const char *filename,
 	err = gpgme_op_decrypt_verify(gpg_context, ciphertext_data,
 		plaintext_data);
 	if (err != GPG_ERR_NO_ERROR) {
-		pb_log("%s: Could not decrypt file\n", __func__);
+		pb_log_fn("Could not decrypt file\n");
 		return -1;
 	}
 	verification_result = gpgme_op_verify_result(gpg_context);
@@ -210,7 +210,7 @@  int decrypt_file(const char *filename,
 	gpgme_release(gpg_context);
 
 	if (!valid) {
-		pb_log("%s: Incorrect GPG signature\n", __func__);
+		pb_log_fn("Incorrect GPG signature\n");
 		return -1;
 	}
 
@@ -242,22 +242,22 @@  int verify_file_signature(const char *plaintext_filename,
 	gpgme_set_locale(NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
 	err = gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP);
 	if (err != GPG_ERR_NO_ERROR) {
-		pb_log("%s: OpenPGP support not available\n", __func__);
+		pb_log_fn("OpenPGP support not available\n");
 		return -1;
 	}
 	err = gpgme_get_engine_info(&enginfo);
 	if (err != GPG_ERR_NO_ERROR) {
-		pb_log("%s: GPG engine failed to initialize\n", __func__);
+		pb_log_fn("GPG engine failed to initialize\n");
 		return -1;
 	}
 	err = gpgme_new(&gpg_context);
 	if (err != GPG_ERR_NO_ERROR) {
-		pb_log("%s: GPG context could not be created\n", __func__);
+		pb_log_fn("GPG context could not be created\n");
 		return -1;
 	}
 	err = gpgme_set_protocol(gpg_context, GPGME_PROTOCOL_OpenPGP);
 	if (err != GPG_ERR_NO_ERROR) {
-		pb_log("%s: GPG protocol could not be set\n", __func__);
+		pb_log_fn("GPG protocol could not be set\n");
 		return -1;
 	}
 	if (keyring_path)
@@ -269,7 +269,7 @@  int verify_file_signature(const char *plaintext_filename,
 			GPGME_PROTOCOL_OpenPGP, enginfo->file_name,
 			enginfo->home_dir);
 	if (err != GPG_ERR_NO_ERROR) {
-		pb_log("%s: Could not set GPG engine information\n", __func__);
+		pb_log_fn("Could not set GPG engine information\n");
 		return -1;
 	}
 	err = gpgme_data_new_from_file(&plaintext_data, plaintext_filename, 1);
@@ -340,7 +340,7 @@  int verify_file_signature(const char *plaintext_filename,
 	gpgme_release(gpg_context);
 
 	if (!valid) {
-		pb_log("%s: Incorrect GPG signature\n", __func__);
+		pb_log_fn("Incorrect GPG signature\n");
 		return -1;
 	}
 
diff --git a/lib/security/openssl.c b/lib/security/openssl.c
index 6454f8a..d9dfb95 100644
--- a/lib/security/openssl.c
+++ b/lib/security/openssl.c
@@ -94,7 +94,7 @@  static int get_pkcs12(FILE *keyfile, X509 **cert, EVP_PKEY **priv)
 		 */
 		if (!PKCS12_parse(p12, NULL, priv, cert, NULL) &&
 		    !PKCS12_parse(p12,   "", priv, cert, NULL)) {
-			pb_log("%s: Error parsing OpenSSL PKCS12:\n", __func__);
+			pb_log_fn("Error parsing OpenSSL PKCS12:\n");
 			ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
 		} else
 			ok = 1;
@@ -131,7 +131,7 @@  static STACK_OF(X509) *get_cert_stack(FILE *keyfile)
 		if (cert)
 			sk_X509_push(certs, get_cert(keyfile));
 	} else {
-		pb_log("%s: Error allocating OpenSSL X509 stack:\n", __func__);
+		pb_log_fn("Error allocating OpenSSL X509 stack:\n");
 		ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
 	}
 
@@ -168,7 +168,7 @@  static EVP_PKEY *get_public_key(FILE *keyfile)
 
 	/* handles both cases */
 	if (!pkey) {
-		pb_log("%s: Error loading OpenSSL public key:\n", __func__);
+		pb_log_fn("Error loading OpenSSL public key:\n");
 		ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
 	}
 
@@ -240,7 +240,7 @@  int decrypt_file(const char *filename,
 
 	certs = sk_X509_new_null();
 	if (!certs) {
-		pb_log("%s: Error allocating OpenSSL X509 stack:\n", __func__);
+		pb_log_fn("Error allocating OpenSSL X509 stack:\n");
 		ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
 		goto out;
 	}
@@ -268,7 +268,7 @@  int decrypt_file(const char *filename,
 	/* in this mode its attached content */
 	if (!CMS_verify(cms, certs, NULL, content_bio, out_bio,
 			CMS_NO_SIGNER_CERT_VERIFY | CMS_BINARY)) {
-		pb_log("%s: Failed OpenSSL CMS decrypt verify:\n", __func__);
+		pb_log_fn("Failed OpenSSL CMS decrypt verify:\n");
 		ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
 		goto out;
 	}
@@ -359,7 +359,7 @@  int verify_file_signature(const char *plaintext_filename,
 
 		if (!CMS_verify(cms, certs, NULL, plaintext_bio, NULL,
 				CMS_DETACHED | CMS_NO_SIGNER_CERT_VERIFY | CMS_BINARY)) {
-			pb_log("%s: Failed OpenSSL CMS verify:\n", __func__);
+			pb_log_fn("Failed OpenSSL CMS verify:\n");
 			ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
 			goto out;
 		}
@@ -375,7 +375,7 @@  int verify_file_signature(const char *plaintext_filename,
 		ctx = EVP_MD_CTX_create();
 
 		if (!ctx) {
-			pb_log("%s: Error allocating OpenSSL MD ctx:\n", __func__);
+			pb_log_fn("Error allocating OpenSSL MD ctx:\n");
 			ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
 			goto out;
 		}
@@ -385,7 +385,7 @@  int verify_file_signature(const char *plaintext_filename,
 			goto out;
 
 		if (EVP_DigestVerifyInit(ctx, NULL, s_verify_md, NULL, pkey) < 1) {
-			pb_log("%s: Error initializing OpenSSL verify:\n", __func__);
+			pb_log_fn("Error initializing OpenSSL verify:\n");
 			ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
 			goto out;
 		}
@@ -425,7 +425,7 @@  int verify_file_signature(const char *plaintext_filename,
 		if (EVP_DigestVerifyFinal(ctx, (unsigned char*)sigbuf, siglen))
 			nok = 0;
 		else {
-			pb_log("%s: Error finalizing OpenSSL verify:\n", __func__);
+			pb_log_fn("Error finalizing OpenSSL verify:\n");
 			ERR_print_errors_cb(&pb_log_print_errors_cb, NULL);
 		}
 	}
diff --git a/lib/url/url.c b/lib/url/url.c
index 6eeced3..157573c 100644
--- a/lib/url/url.c
+++ b/lib/url/url.c
@@ -193,7 +193,7 @@  struct pb_url *pb_url_parse(void *ctx, const char *url_str)
 		path = strchr(p, '/');
 
 		if (!path) {
-			pb_log("%s: parse path failed '%s'\n", __func__ , p);
+			pb_log_fn("parse path failed '%s'\n" , p);
 			goto fail;
 		}
 
diff --git a/ui/common/discover-client.c b/ui/common/discover-client.c
index 88d0b4e..d941497 100644
--- a/ui/common/discover-client.c
+++ b/ui/common/discover-client.c
@@ -197,7 +197,7 @@  static int discover_client_process(void *arg)
 
 		rc = pb_protocol_deserialise_device(dev, message);
 		if (rc) {
-			pb_log("%s: no device?\n", __func__);
+			pb_log_fn("no device?\n");
 			goto out;
 		}
 
@@ -208,7 +208,7 @@  static int discover_client_process(void *arg)
 
 		rc = pb_protocol_deserialise_boot_option(opt, message);
 		if (rc) {
-			pb_log("%s: no boot_option?\n", __func__);
+			pb_log_fn("no boot_option?\n");
 			goto out;
 		}
 
@@ -217,7 +217,7 @@  static int discover_client_process(void *arg)
 	case PB_PROTOCOL_ACTION_DEVICE_REMOVE:
 		dev_id = pb_protocol_deserialise_string(ctx, message);
 		if (!dev_id) {
-			pb_log("%s: no device id?\n", __func__);
+			pb_log_fn("no device id?\n");
 			goto out;
 		}
 		device_remove(client, dev_id);
@@ -227,7 +227,7 @@  static int discover_client_process(void *arg)
 
 		rc = pb_protocol_deserialise_boot_status(status, message);
 		if (rc) {
-			pb_log("%s: invalid status message?\n", __func__);
+			pb_log_fn("invalid status message?\n");
 			goto out;
 		}
 		update_status(client, status);
@@ -237,7 +237,7 @@  static int discover_client_process(void *arg)
 
 		rc = pb_protocol_deserialise_system_info(sysinfo, message);
 		if (rc) {
-			pb_log("%s: invalid sysinfo message?\n", __func__);
+			pb_log_fn("invalid sysinfo message?\n");
 			goto out;
 		}
 		update_sysinfo(client, sysinfo);
@@ -247,7 +247,7 @@  static int discover_client_process(void *arg)
 
 		rc = pb_protocol_deserialise_config(config, message);
 		if (rc) {
-			pb_log("%s: invalid config message?\n", __func__);
+			pb_log_fn("invalid config message?\n");
 			goto out;
 		}
 		update_config(client, config);
@@ -257,7 +257,7 @@  static int discover_client_process(void *arg)
 
 		rc = pb_protocol_deserialise_plugin_option(p_opt, message);
 		if (rc) {
-			pb_log("%s: no plugin_option?\n", __func__);
+			pb_log_fn("no plugin_option?\n");
 			goto out;
 		}
 
@@ -267,7 +267,7 @@  static int discover_client_process(void *arg)
 		plugins_remove(client);
 		break;
 	default:
-		pb_log("%s: unknown action %d\n", __func__, message->action);
+		pb_log_fn("unknown action %d\n", message->action);
 	}
 
 out:
@@ -291,7 +291,7 @@  struct discover_client* discover_client_init(struct waitset *waitset,
 
 	client->fd = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (client->fd < 0) {
-		pb_log("%s: socket: %s\n", __func__, strerror(errno));
+		pb_log_fn("socket: %s\n", strerror(errno));
 		goto out_err;
 	}
 
@@ -304,7 +304,7 @@  struct discover_client* discover_client_init(struct waitset *waitset,
 	strcpy(addr.sun_path, PB_SOCKET_PATH);
 
 	if (connect(client->fd, (struct sockaddr *)&addr, sizeof(addr))) {
-		pb_log("%s: connect: %s\n", __func__, strerror(errno));
+		pb_log_fn("connect: %s\n", strerror(errno));
 		goto out_err;
 	}
 
diff --git a/ui/common/joystick.c b/ui/common/joystick.c
index a3d6abd..f75ae3d 100644
--- a/ui/common/joystick.c
+++ b/ui/common/joystick.c
@@ -47,7 +47,7 @@  int pjs_process_event(const struct pjs *pjs)
 	result = read(pjs->fd, &e, sizeof(e));
 
 	if (result != sizeof(e)) {
-		pb_log("%s: read failed: %s\n", __func__, strerror(errno));
+		pb_log_fn("read failed: %s\n", strerror(errno));
 		return 0;
 	}
 
@@ -86,7 +86,7 @@  struct pjs *pjs_init(void *ctx, int (*map)(const struct js_event *))
 	pjs->fd = open(dev_name, O_RDONLY | O_NONBLOCK);
 
 	if (pjs->fd < 0) {
-		pb_log("%s: open %s failed: %s\n", __func__, dev_name,
+		pb_log_fn("open %s failed: %s\n", dev_name,
 			strerror(errno));
 		goto out_err;
 	}
diff --git a/ui/common/ps3.c b/ui/common/ps3.c
index c9b97b5..d2a57a5 100644
--- a/ui/common/ps3.c
+++ b/ui/common/ps3.c
@@ -79,7 +79,7 @@  static int ps3_flash_open(struct ps3_flash_ctx *fc, const char *mode)
 	fc->dev = fopen(flash_dev, mode);
 
 	if (!fc->dev) {
-		pb_log("%s: fopen failed: %s: %s\n", __func__, strerror(errno),
+		pb_log_fn("fopen failed: %s: %s\n", strerror(errno),
 			flash_dev);
 		return -1;
 	}
@@ -89,7 +89,7 @@  static int ps3_flash_open(struct ps3_flash_ctx *fc, const char *mode)
 	result = os_area_fixed_read(&fc->header, &fc->params, fc->dev);
 
 	if (result) {
-		pb_log("%s: os_area_fixed_read failed\n", __func__);
+		pb_log_fn("os_area_fixed_read failed\n");
 		goto fail;
 	}
 
@@ -123,7 +123,7 @@  int ps3_flash_get_values(struct ps3_flash_values *values)
 	ps3_flash_close(&fc);
 
 	if (result) {
-		pb_log("%s: os_area_db_read failed: %s\n", __func__,
+		pb_log_fn("os_area_db_read failed: %s\n",
 			strerror(errno));
 		goto fail;
 	}
@@ -176,14 +176,14 @@  int ps3_flash_set_values(const struct ps3_flash_values *values)
 	result = os_area_db_read(&fc.db, &fc.header, fc.dev);
 
 	if (result) {
-		pb_log("%s: os_area_db_read failed: %s\n", __func__,
+		pb_log_fn("os_area_db_read failed: %s\n",
 			strerror(errno));
-		pb_log("%s: formating db\n", __func__);
+		pb_log_fn("formating db\n");
 
 		result = os_area_db_format(&fc.db, &fc.header, fc.dev);
 
 		if (result) {
-			pb_log("%s: db_format failed: %s\n", __func__,
+			pb_log_fn("db_format failed: %s\n",
 				strerror(errno));
 			goto fail;
 		}
@@ -220,7 +220,7 @@  static int ps3_video_ioctl(int request, unsigned int *mode_id)
 	fd = open(fb_dev, O_RDWR);
 
 	if (fd < 0) {
-		pb_log("%s: open failed: %s: %s\n", __func__, strerror(errno),
+		pb_log_fn("open failed: %s: %s\n", strerror(errno),
 			fb_dev);
 		return -1;
 	}
@@ -230,7 +230,7 @@  static int ps3_video_ioctl(int request, unsigned int *mode_id)
 	close(fd);
 
 	if (result < 0) {
-		pb_log("%s: ioctl failed: %s: %s\n", __func__, strerror(errno),
+		pb_log_fn("ioctl failed: %s: %s\n", strerror(errno),
 			fb_dev);
 		return -1;
 	}
@@ -266,6 +266,6 @@  int ps3_get_video_mode(unsigned int *mode_id)
 
 	result =  ps3_video_ioctl(PS3FB_IOCTL_GETMODE, mode_id);
 
-	pb_log("%s: %u\n", __func__, *mode_id);
+	pb_log_fn("%u\n", *mode_id);
 	return result;
 }
diff --git a/ui/common/timer.c b/ui/common/timer.c
index b0cae0d..23c3e62 100644
--- a/ui/common/timer.c
+++ b/ui/common/timer.c
@@ -35,7 +35,7 @@ 
 void ui_timer_init(struct waitset *waitset, struct ui_timer *timer,
 		unsigned int seconds)
 {
-	pb_log("%s: %u\n", __func__, seconds);
+	pb_log_fn("%u\n", seconds);
 	timer->timeout = seconds;
 	timer->waitset = waitset;
 }
diff --git a/ui/common/ui-system.c b/ui/common/ui-system.c
index 7e04801..02142db 100644
--- a/ui/common/ui-system.c
+++ b/ui/common/ui-system.c
@@ -78,7 +78,7 @@  unsigned int pb_elf_hash(const char *str)
 			h ^= g >> 24;
 		h &= ~g;
 	}
-	pb_log("%s: %x\n", __func__, h);
+	pb_log_fn("%x\n", h);
 	return h;
 }
 
diff --git a/ui/ncurses/generic-main.c b/ui/ncurses/generic-main.c
index 7062796..096eb56 100644
--- a/ui/ncurses/generic-main.c
+++ b/ui/ncurses/generic-main.c
@@ -245,7 +245,7 @@  int main(int argc, char *argv[])
 	result += sigaction(SIGWINCH, &sa, NULL);
 
 	if (result) {
-		pb_log("%s sigaction failed.\n", __func__);
+		pb_log_fn("sigaction failed.\n");
 		return EXIT_FAILURE;
 	}
 
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index 87d2503..3abeac3 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -169,7 +169,7 @@  static void cui_atexit(void)
 
 void cui_abort(struct cui *cui)
 {
-	pb_log("%s: exiting\n", __func__);
+	pb_log_fn("exiting\n");
 	cui->abort = 1;
 }
 
@@ -254,7 +254,7 @@  int cui_run_cmd(struct cui *cui, const char **cmd_argv)
 	nc_scr_post(cui->current);
 
 	if (result) {
-		pb_log("%s: failed: '%s'\n", __func__, cmd_argv[0]);
+		pb_log_fn("failed: '%s'\n", cmd_argv[0]);
 		nc_scr_status_printf(cui->current, _("Failed: %s"),
 				cmd_argv[0]);
 	}
@@ -688,7 +688,7 @@  static void cui_handle_resize(struct cui *cui)
 	struct winsize ws;
 
 	if (ioctl(1, TIOCGWINSZ, &ws) == -1) {
-		pb_log("%s: ioctl failed: %s\n", __func__, strerror(errno));
+		pb_log_fn("ioctl failed: %s\n", strerror(errno));
 		return;
 	}
 
@@ -783,7 +783,7 @@  static int cui_boot_option_add(struct device *dev, struct boot_option *opt,
 	result = set_menu_items(menu->ncm, NULL);
 
 	if (result)
-		pb_log("%s: set_menu_items failed: %d\n", __func__, result);
+		pb_log_fn("set_menu_items failed: %d\n", result);
 
 	/* Insert new items at insert_pt. */
 	if (dev_hdr) {
@@ -798,10 +798,10 @@  static int cui_boot_option_add(struct device *dev, struct boot_option *opt,
 	}
 
 	if (plugin_option) {
-		pb_log("%s: adding plugin '%s'\n", __func__, cod->name);
+		pb_log_fn("adding plugin '%s'\n", cod->name);
 		pb_log("   file  '%s'\n", cod->pd->plugin_file);
 	} else {
-		pb_log("%s: adding opt '%s'\n", __func__, cod->name);
+		pb_log_fn("adding opt '%s'\n", cod->name);
 		pb_log("   image  '%s'\n", cod->bd->image);
 		pb_log("   initrd '%s'\n", cod->bd->initrd);
 		pb_log("   args   '%s'\n", cod->bd->args);
@@ -826,14 +826,14 @@  static int cui_boot_option_add(struct device *dev, struct boot_option *opt,
 		}
 		result = set_menu_items(cui->main->ncm, cui->main->items);
 		if (result)
-			pb_log("%s: set_menu_items failed: %d\n", __func__, result);
+			pb_log_fn("set_menu_items failed: %d\n", result);
 	}
 
 	/* Re-attach the items array. */
 	result = set_menu_items(menu->ncm, menu->items);
 
 	if (result)
-		pb_log("%s: set_menu_items failed: %d\n", __func__, result);
+		pb_log_fn("set_menu_items failed: %d\n", result);
 
 	if (0) {
 		pb_log("%s\n", __func__);
@@ -878,7 +878,7 @@  static void cui_device_remove(struct device *dev, void *arg)
 	int rows, cols, top, last;
 	int result;
 
-	pb_log("%s: %p %s\n", __func__, dev, dev->id);
+	pb_log_fn("%p %s\n", dev, dev->id);
 
 	if (cui->current == &cui->main->scr)
 		nc_scr_unpost(cui->current);
@@ -891,7 +891,7 @@  static void cui_device_remove(struct device *dev, void *arg)
 	result |= set_menu_items(cui->plugin_menu->ncm, NULL);
 
 	if (result)
-		pb_log("%s: set_menu_items failed: %d\n", __func__, result);
+		pb_log_fn("set_menu_items failed: %d\n", result);
 
 	list_for_each_entry(&dev->boot_options, opt, list) {
 		struct pmenu_item *item = pmenu_item_from_arg(opt->ui_info);
@@ -948,7 +948,7 @@  static void cui_device_remove(struct device *dev, void *arg)
 	}
 
 	if (result)
-		pb_log("%s: set_menu_items failed: %d\n", __func__, result);
+		pb_log_fn("set_menu_items failed: %d\n", result);
 
 	if (0) {
 		pb_log("%s\n", __func__);
@@ -1300,14 +1300,14 @@  static struct pmenu *main_menu_init(struct cui *cui)
 
 	m = pmenu_init(cui, 9, cui_on_exit);
 	if (!m) {
-		pb_log("%s: failed\n", __func__);
+		pb_log_fn("failed\n");
 		return NULL;
 	}
 
 	m->n_hot_keys = 1;
 	m->hot_keys = talloc_array(m, hot_key_fn, m->n_hot_keys);
 	if (!m->hot_keys) {
-		pb_log("%s: failed to allocate hot_keys\n", __func__);
+		pb_log_fn("failed to allocate hot_keys\n");
 		talloc_free(m);
 		return NULL;
 	}
@@ -1506,7 +1506,7 @@  struct cui *cui_init(void* platform_info,
 
 	cui = talloc_zero(NULL, struct cui);
 	if (!cui) {
-		pb_log("%s: alloc cui failed.\n", __func__);
+		pb_log_fn("alloc cui failed.\n");
 		fprintf(stderr, _("%s: alloc cui failed.\n"), __func__);
 		goto fail_alloc;
 	}
@@ -1526,7 +1526,7 @@  retry_start:
 				&cui_client_ops, cui);
 		if (cui->client || !i)
 			break;
-		pb_log("%s: waiting for server %d\n", __func__, i);
+		pb_log_fn("waiting for server %d\n", i);
 		sleep(1);
 	}
 
@@ -1540,7 +1540,7 @@  retry_start:
 		if (!result)
 			goto retry_start;
 
-		pb_log("%s: discover_client_init failed.\n", __func__);
+		pb_log_fn("discover_client_init failed.\n");
 		fprintf(stderr, _("%s: error: discover_client_init failed.\n"),
 			__func__);
 		fprintf(stderr, _("could not start pb-discover, the petitboot "
@@ -1554,7 +1554,7 @@  retry_start:
 		waiter_register_timeout(cui->waitset, 0,
 					cui_server_wait, cui);
 	} else if (!cui->client) {
-		pb_log("%s: discover_client_init failed.\n", __func__);
+		pb_log_fn("discover_client_init failed.\n");
 		fprintf(stderr, _("%s: error: discover_client_init failed.\n"),
 			__func__);
 		fprintf(stderr, _("check that pb-discover, "
@@ -1653,7 +1653,7 @@  int cui_run(struct cui *cui)
 		int result = waiter_poll(cui->waitset);
 
 		if (result < 0) {
-			pb_log("%s: poll: %s\n", __func__, strerror(errno));
+			pb_log_fn("poll: %s\n", strerror(errno));
 			break;
 		}
 
diff --git a/ui/ncurses/nc-menu.c b/ui/ncurses/nc-menu.c
index a6c2b15..a90a02e 100644
--- a/ui/ncurses/nc-menu.c
+++ b/ui/ncurses/nc-menu.c
@@ -117,7 +117,7 @@  static const char *pmenu_item_label(struct pmenu_item *item, const char *name)
 	label = talloc_array(item, char, len + 1);
 	wcstombs(label, tmp, len + 1);
 
-	pb_log("%s: %s\n", __func__, label);
+	pb_log_fn("%s\n", label);
 
 	talloc_free(tmp);
 	return label;
@@ -357,7 +357,7 @@  static int pmenu_item_get_index(const struct pmenu_item *item)
 			if (item->pmenu->items[i] == item->nci)
 				return i;
 
-	pb_log("%s: not found: %p %s\n", __func__, item,
+	pb_log_fn("not found: %p %s\n", item,
 		(item ? item->nci->name.str : "(null)"));
 	return -1;
 }
@@ -491,7 +491,7 @@  unsigned int pmenu_grow(struct pmenu *menu, unsigned int count)
 
 	assert(item_count(menu->ncm) == 0 && "not disconnected");
 
-	pb_log("%s: %u current + %u new = %u\n", __func__, menu->item_count,
+	pb_log_fn("%u current + %u new = %u\n", menu->item_count,
 		count, menu->item_count + count);
 
 	/* Note that items array has a null terminator. */
@@ -526,7 +526,7 @@  int pmenu_remove(struct pmenu *menu, struct pmenu_item *item)
 
 	assert(menu->item_count);
 
-	pb_log("%s: %u\n", __func__, menu->item_count);
+	pb_log_fn("%u\n", menu->item_count);
 
 	index = pmenu_item_get_index(item);
 
diff --git a/ui/ncurses/ps3-main.c b/ui/ncurses/ps3-main.c
index f60a05e..eda15d0 100644
--- a/ui/ncurses/ps3-main.c
+++ b/ui/ncurses/ps3-main.c
@@ -407,14 +407,14 @@  static struct pmenu *ps3_mm_init(struct ps3_cui *ps3_cui)
 	m = pmenu_init(ps3_cui->cui, 3, cui_on_exit);
 
 	if (!m) {
-		pb_log("%s: failed\n", __func__);
+		pb_log_fn("failed\n");
 		return NULL;
 	}
 
 	m->n_hot_keys = 2;
 	m->hot_keys = talloc_array(m, hot_key_fn *, m->n_hot_keys);
 	if (!m->hot_keys) {
-		pb_log("%s: failed to allocate hot_keys\n", __func__);
+		pb_log_fn("failed to allocate hot_keys\n");
 		talloc_free(m);
 		return NULL;
 	}
@@ -474,7 +474,7 @@  static struct pmenu *ps3_svm_init(struct ps3_cui *ps3_cui)
 	m = pmenu_init(ps3_cui->cui, 12, ps3_svm_to_mm_helper);
 
 	if (!m) {
-		pb_log("%s: failed\n", __func__);
+		pb_log_fn("failed\n");
 		return NULL;
 	}
 
@@ -621,7 +621,7 @@  int main(int argc, char *argv[])
 	result += sigaction(SIGWINCH, &sa, NULL);
 
 	if (result) {
-		pb_log("%s sigaction failed.\n", __func__);
+		pb_log_fn("sigaction failed.\n");
 		return EXIT_FAILURE;
 	}
 
diff --git a/ui/twin/main-generic.c b/ui/twin/main-generic.c
index 8ddec9e..a85cace 100644
--- a/ui/twin/main-generic.c
+++ b/ui/twin/main-generic.c
@@ -204,7 +204,7 @@  static int run(struct pbt_client *client)
 		int result = waiter_poll(client->waitset);
 
 		if (result < 0) {
-			pb_log("%s: poll: %s\n", __func__, strerror(errno));
+			pb_log_fn("poll: %s\n", strerror(errno));
 			break;
 		}
 
@@ -304,7 +304,7 @@  int main(int argc, char *argv[])
 	result += sigaction(SIGWINCH, &sa, NULL);
 
 	if (result) {
-		pb_log("%s sigaction failed.\n", __func__);
+		pb_log_fn("sigaction failed.\n");
 		return EXIT_FAILURE;
 	}
 
diff --git a/ui/twin/main-ps3.c b/ui/twin/main-ps3.c
index ba4b1d7..f98aca8 100644
--- a/ui/twin/main-ps3.c
+++ b/ui/twin/main-ps3.c
@@ -411,7 +411,7 @@  int main(int argc, char *argv[])
 	result += sigaction(SIGWINCH, &sa, NULL);
 
 	if (result) {
-		pb_log("%s sigaction failed.\n", __func__);
+		pb_log_fn("sigaction failed.\n");
 		return EXIT_FAILURE;
 	}
 
diff --git a/ui/twin/pbt-client.c b/ui/twin/pbt-client.c
index 48de816..cffb5de 100644
--- a/ui/twin/pbt-client.c
+++ b/ui/twin/pbt-client.c
@@ -66,7 +66,7 @@  static int pbt_client_boot(struct pbt_item *item)
 			NULL, opt_data->opt, opt_data->bd);
 
 	if (result) {
-		pb_log("%s: failed: %s\n", __func__, opt_data->bd->image);
+		pb_log_fn("failed: %s\n", opt_data->bd->image);
 		pbt_frame_status_printf(&item->pbt_client->frame,
 				"Failed: kexec %s", opt_data->bd->image);
 	}
@@ -194,7 +194,7 @@  static void pbt_device_remove(struct device *dev, struct pbt_client *client)
 	}
 
 	if (!removed_item) {
-		pb_log("%s: %p %s: unknown device\n", __func__, dev, dev->id);
+		pb_log_fn("%p %s: unknown device\n", dev, dev->id);
 		assert(0 && "unknown device");
 		return;
 	}
@@ -260,7 +260,7 @@  struct pbt_client *pbt_client_init(enum pbt_twin_backend backend,
 	pbt_client = talloc_zero(NULL, struct pbt_client);
 
 	if (!pbt_client) {
-		pb_log("%s: alloc pbt_client failed.\n", __func__);
+		pb_log_fn("alloc pbt_client failed.\n");
 		fprintf(stderr, "%s: alloc pbt_client failed.\n", __func__);
 		goto fail_alloc;
 	}
@@ -288,7 +288,7 @@  retry_start:
 					&pbt_client_ops, pbt_client);
 		if (pbt_client->discover_client || !i)
 			break;
-		pb_log("%s: waiting for server %d\n", __func__, i);
+		pb_log_fn("waiting for server %d\n", i);
 		sleep(1);
 	}
 
@@ -302,7 +302,7 @@  retry_start:
 		if (!result)
 			goto retry_start;
 
-		pb_log("%s: discover_client_init failed.\n", __func__);
+		pb_log_fn("discover_client_init failed.\n");
 		fprintf(stderr, "%s: error: discover_client_init failed.\n",
 			__func__);
 		fprintf(stderr, "could not start pb-discover, the petitboot "
@@ -311,7 +311,7 @@  retry_start:
 	}
 
 	if (!pbt_client->discover_client) {
-		pb_log("%s: discover_client_init failed.\n", __func__);
+		pb_log_fn("discover_client_init failed.\n");
 		fprintf(stderr, "%s: error: discover_client_init failed.\n",
 			__func__);
 		fprintf(stderr, "check that pb-discover, "
diff --git a/ui/twin/pbt-scr.c b/ui/twin/pbt-scr.c
index e10cab1..c360047 100644
--- a/ui/twin/pbt-scr.c
+++ b/ui/twin/pbt-scr.c
@@ -138,7 +138,7 @@  twin_pixmap_t *pbt_background_load(twin_screen_t *tscreen,
 	raw_background = twin_jpeg_to_pixmap(filename, TWIN_ARGB32);
 
 	if (!raw_background) {
-		pb_log("%s: loading image '%s' failed\n", __func__, filename);
+		pb_log_fn("loading image '%s' failed\n", filename);
 
 		/* Fallback to a default pattern */
 
@@ -158,7 +158,7 @@  twin_pixmap_t *pbt_background_load(twin_screen_t *tscreen,
 				tscreen->width,
 				tscreen->height);
 	if (!scaled_background) {
-		pb_log("%s: scale '%s' failed\n", __func__, filename);
+		pb_log_fn("scale '%s' failed\n", filename);
 		twin_pixmap_destroy(raw_background);
 		return twin_make_pattern();
 	}
@@ -224,7 +224,7 @@  retry:
 	new.icon = twin_png_to_pixmap(filename, TWIN_ARGB32);
 
 	if (!new.icon) {
-		pb_log("%s: loading image '%s' failed\n", __func__, filename);
+		pb_log_fn("loading image '%s' failed\n", filename);
 
 		if (filename == default_icon_file)
 			return NULL;
@@ -384,7 +384,7 @@  struct pbt_scr *pbt_scr_init(void *talloc_ctx,
 	assert(backend && backend < 3);
 
 	if (!scr) {
-		pb_log("%s: alloc pbt_scr failed.\n", __func__);
+		pb_log_fn("alloc pbt_scr failed.\n");
 		goto fail_alloc;
 	}
 
@@ -395,7 +395,7 @@  struct pbt_scr *pbt_scr_init(void *talloc_ctx,
 	scr->twin_ctx.backend = backend;
 
 	if (backend == pbt_twin_x11) {
-		pb_log("%s: using twin x11 backend.\n", __func__);
+		pb_log_fn("using twin x11 backend.\n");
 		assert(width > 100);
 		assert(height > 100);
 
@@ -406,7 +406,7 @@  struct pbt_scr *pbt_scr_init(void *talloc_ctx,
 			width, height, 0);
 
 		if (!scr->twin_ctx.x11) {
-			pb_log("%s: twin_x11_create_ext failed.\n", __func__);
+			pb_log_fn("twin_x11_create_ext failed.\n");
 			perror("failed to create twin x11 context\n");
 			goto fail_ctx_create;
 		}
@@ -418,14 +418,14 @@  struct pbt_scr *pbt_scr_init(void *talloc_ctx,
 		waiter_fd = ConnectionNumber(scr->twin_ctx.x11->dpy);
 #endif
 	} else if (backend == pbt_twin_fbdev) {
-		pb_log("%s: using twin fbdev backend.\n", __func__);
+		pb_log_fn("using twin fbdev backend.\n");
 #if !defined(HAVE_LIBTWIN_TWIN_FBDEV_H)
 		assert(0);
 #else
 		scr->twin_ctx.fbdev = twin_fbdev_create_ext(-1, SIGUSR1, 0);
 
 		if (!scr->twin_ctx.fbdev) {
-			pb_log("%s: twin_fbdev_create_ext failed.\n", __func__);
+			pb_log_fn("twin_fbdev_create_ext failed.\n");
 			perror("failed to create twin fbdev context\n");
 			goto fail_ctx_create;
 		}