logging: Change stderr + file target to use non-blocking write

So far, we used blocking, buffered fwrite() to write to stderr
and file targets.  This causes problems if there are [slow] consumers
causing delays, such as gnome-terminal (when the program is started
interactively) or systemd/journald (where we observe 64..128ms blocks on
stderr).

This patch introduces stderr/file based logging via write_queue
and osmo_select_main(), i.e. switch from glibc-buffered, blocking
to internally buffered, non-blocking writes.

* when osmo_stderr_target is created via application.c, we create it
  in blocking stream mode for backwards compatibility, particularly
  for [smaller] programs that don't use osmo_select_main()

* when the VTY code encounters 'log stderr' or 'log file FILENAME',
  we switch that respective target to non-blocking write-queue mode,
  as this means the application is in fact using osmo_select_main()

* The config file can now state 'log stderr blocking-io' or
  'log file FILENAME blocking-io' to explicitly enforce using blocking
  stream based I/O

* The application can at any time use API functions to switch either way

Closes: OS#4311
Change-Id: Ia58fd78535c41b3da3aeb7733aadc785ace610da
diff --git a/tests/logging/logging_vty_test.c b/tests/logging/logging_vty_test.c
index e7019f6..078555e 100644
--- a/tests/logging/logging_vty_test.c
+++ b/tests/logging/logging_vty_test.c
@@ -254,6 +254,7 @@
 	log_set_print_category_hex(osmo_stderr_target, 0);
 	log_set_print_level(osmo_stderr_target, 1);
 	log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
+	log_target_file_switch_to_wqueue(osmo_stderr_target);
 
 	if (cmdline_config.config_file) {
 		rc = vty_read_config_file(cmdline_config.config_file, NULL);