From 345db32bb1d84b4a7b00f4ffef9a50032ea2c0e8 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Fri, 14 Mar 2025 16:31:16 +0100 Subject: [PATCH] Always use stderr instead of stdout for server logs --- server/audio/audio_pulse.cpp | 6 +++--- server/avahi_publisher.cpp | 2 +- server/encoder/video_encoder_nvenc.cpp | 22 ---------------------- server/main.cpp | 6 +++--- 4 files changed, 7 insertions(+), 29 deletions(-) diff --git a/server/audio/audio_pulse.cpp b/server/audio/audio_pulse.cpp index 3a3d5f7e..6be04386 100644 --- a/server/audio/audio_pulse.cpp +++ b/server/audio/audio_pulse.cpp @@ -59,10 +59,10 @@ void unload_module(pa_context * ctx, uint32_t id) std::promise p; wrap_lambda cb = [&p, id](pa_context *, int success) { if (not success) - std::cout << "failed to unload pulseaudio module " << id + std::cerr << "failed to unload pulseaudio module " << id << std::endl; else - std::cout << "pulseaudio module " << id << " unloaded" + std::cerr << "pulseaudio module " << id << " unloaded" << std::endl; p.set_value(); }; @@ -279,7 +279,7 @@ struct pulse_device : public audio_device } catch (const std::exception & e) { - std::cout << "failed to depublish pulseaudio modules: " + std::cerr << "failed to depublish pulseaudio modules: " << e.what() << std::endl; } } diff --git a/server/avahi_publisher.cpp b/server/avahi_publisher.cpp index df948d61..6316c907 100644 --- a/server/avahi_publisher.cpp +++ b/server/avahi_publisher.cpp @@ -98,7 +98,7 @@ void avahi_publisher::avahi_entry_group_callback( switch (state) { case AVAHI_ENTRY_GROUP_ESTABLISHED: - std::cout << "Service published: " << self->name << std::endl; + std::cerr << "Service published: " << self->name << std::endl; case AVAHI_ENTRY_GROUP_FAILURE: case AVAHI_ENTRY_GROUP_REGISTERING: case AVAHI_ENTRY_GROUP_UNCOMMITED: diff --git a/server/encoder/video_encoder_nvenc.cpp b/server/encoder/video_encoder_nvenc.cpp index ab3212b5..b6d976a0 100644 --- a/server/encoder/video_encoder_nvenc.cpp +++ b/server/encoder/video_encoder_nvenc.cpp @@ -165,28 +165,6 @@ video_encoder_nvenc::video_encoder_nvenc( presets.resize(count); NVENC_CHECK(fn.nvEncGetEncodePresetGUIDs(session_handle, encodeGUID, presets.data(), count, &count)); - switch (settings.codec) - { - case video_codec::h264: - printf("%d H264 presets\n", count); - break; - - case video_codec::h265: - printf("%d HEVC presets\n", count); - break; - - case video_codec::av1: - printf("%d AV1 presets\n", count); - break; - } - - for (GUID & i: presets) - { - printf(" Preset {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", i.Data1, i.Data2, i.Data3, i.Data4[0], i.Data4[1], i.Data4[2], i.Data4[3], i.Data4[4], i.Data4[5], i.Data4[6], i.Data4[7]); - } - - // auto presetGUID = codec == video_codec::h264 ? NV_ENC_PRESET_LOW_LATENCY_DEFAULT_GUID : - // NV_ENC_PRESET_P7_GUID; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" auto presetGUID = NV_ENC_PRESET_P4_GUID; diff --git a/server/main.cpp b/server/main.cpp index f0e0b624..8522e517 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -449,7 +449,7 @@ void update_fsm() int sigint(void * sig_nr) { - std::cout << strsignal((uintptr_t)sig_nr) << std::endl; + std::cerr << strsignal((uintptr_t)sig_nr) << std::endl; quitting_main_loop = true; @@ -468,7 +468,7 @@ gboolean headset_connected_success(void *) init_cleanup_functions(); - std::cout << "Client connected" << std::endl; + std::cerr << "Client connected" << std::endl; expose_known_keys_on_dbus(); @@ -496,7 +496,7 @@ gboolean headset_connected_incorrect_pin(void *) connection_thread.reset(); delay_next_try = 2 * delay_next_try; - std::cout << "Waiting " << delay_next_try << " until the next attempt is allowed" << std::endl; + std::cerr << "Waiting " << delay_next_try << " until the next attempt is allowed" << std::endl; update_fsm(); return G_SOURCE_REMOVE;