Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,9 @@ if(BUILD_DAEMON)
target_include_directories(gradient-motiond PRIVATE ${LIBLO_INCLUDE_DIRS})
endif()

if(ENABLE_CUEMS_LOGGER)
target_compile_definitions(gradient-motiond PRIVATE HAVE_CUEMS_LOGGER)
target_link_libraries(gradient-motiond PRIVATE cuemslogger)
endif()
# HAVE_CUEMS_LOGGER + cuemslogger now arrive via gradient_motion's
# PUBLIC usage requirements (src/CMakeLists.txt) — armed on the library
# so all its objects and every consumer share one logging backend.

# Install rules — places the daemon at <prefix>/bin/gradient-motiond.
# debian/rules sets CMAKE_INSTALL_PREFIX=/usr so the .deb ships
Expand Down
2 changes: 1 addition & 1 deletion cuemslogger
17 changes: 8 additions & 9 deletions daemon/comms/OscServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ struct OscServer::Impl {
bool started = false;

static void errorHandler(int num, const char* msg, const char* where) {
std::fprintf(stderr, "ERROR OscServer: liblo error %d — %s (path: %s)\n",
num, msg ? msg : "", where ? where : "");
GME_LOG_ERROR("OscServer: liblo error " + std::to_string(num) + " — "
+ (msg ? msg : "") + " (path: " + (where ? where : "") + ")");
}

// Per-address callback entry point (called on the liblo network thread).
Expand Down Expand Up @@ -84,11 +84,11 @@ struct OscServer::Impl {
break;
}
} catch (const std::exception& e) {
std::fprintf(stderr, "ERROR OscServer: exception in callback for %s: %s\n",
path, e.what());
GME_LOG_ERROR("OscServer: exception in callback for " + std::string(path)
+ ": " + e.what());
} catch (...) {
std::fprintf(stderr, "ERROR OscServer: unknown exception in callback for %s\n",
path);
GME_LOG_ERROR("OscServer: unknown exception in callback for "
+ std::string(path));
}
return 0; // 0 = handled; do not try further methods
}
Expand Down Expand Up @@ -125,8 +125,7 @@ bool OscServer::start() {
impl_->server_thread = lo_server_thread_new(port_str.c_str(), Impl::errorHandler);

if (!impl_->server_thread) {
std::fprintf(stderr, "FATAL OscServer: failed to bind UDP port %s\n",
port_str.c_str());
GME_LOG_CRITICAL("OscServer: failed to bind UDP port " + port_str);
return false;
}

Expand All @@ -143,7 +142,7 @@ bool OscServer::start() {
Impl::onMessage, impl_.get());

if (lo_server_thread_start(impl_->server_thread) != 0) {
std::fprintf(stderr, "FATAL OscServer: lo_server_thread_start failed\n");
GME_LOG_CRITICAL("OscServer: lo_server_thread_start failed");
lo_server_thread_free(impl_->server_thread);
impl_->server_thread = nullptr;
return false;
Expand Down
2 changes: 1 addition & 1 deletion mtcreceiver
Submodule mtcreceiver updated 3 files
+19 −0 CLAUDE.md
+76 −35 mtcreceiver.cpp
+28 −4 mtcreceiver.h
14 changes: 14 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ target_include_directories(gradient_motion PUBLIC
${CMAKE_SOURCE_DIR}
)

# Arm the CuemsLogger backend on the LIBRARY, not just the daemon executable.
# Previously only mtcreceiver and gradient-motiond carried HAVE_CUEMS_LOGGER,
# so every GME_LOG_* compiled into this library fell back to the std::cerr
# emitter — under systemd those lines are stamped PRIORITY=6 and invisible to
# `cuems-logs -e` — and GradientEngine.cpp, listed in BOTH targets, was
# compiled twice with two different logging backends. PUBLIC on purpose: the
# daemon and the test binaries then share one backend (side effect: ctest
# output for the 5 test binaries goes to syslog when cuemslogger is enabled).
# The TARGET guard covers BUILD_DAEMON=OFF, where cuemslogger is never added.
if(ENABLE_CUEMS_LOGGER AND TARGET cuemslogger)
target_compile_definitions(gradient_motion PUBLIC HAVE_CUEMS_LOGGER)
target_link_libraries(gradient_motion PUBLIC cuemslogger)
endif()

target_link_libraries(gradient_motion PUBLIC
nlohmann_json::nlohmann_json
)
Expand Down
5 changes: 3 additions & 2 deletions src/gradient/CurveFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "EaseOutCurve.h"
#include "SCurve.h"
#include "ResampledCurve.h"
#include "daemon/logging.h"

namespace gme {
namespace gradient {
Expand Down Expand Up @@ -54,8 +55,8 @@ CurveFactory::createCurve(const std::string& type,
inner = std::make_unique<SCurve>();

} else {
std::cerr << "[CurveFactory] Unknown curve type: '"
<< type << "' — returning nullopt\n";
GME_LOG_WARNING("CurveFactory: unknown curve type '" + std::string(type)
+ "' — returning nullopt");
return std::nullopt;
}

Expand Down
15 changes: 8 additions & 7 deletions src/motion/MotionFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <nlohmann/json.hpp>
#include <cstdio>
#include "daemon/logging.h"

namespace gme {
namespace motion {
Expand All @@ -29,8 +30,8 @@ static std::unique_ptr<IMotion> makeFadeMotion(const gme::signal::FadeCommand& c
: cmd.curve_params;
auto curveOpt = gme::gradient::CurveFactory::createCurve(cmd.curve_type, params);
if (!curveOpt) {
std::fprintf(stderr, "WARNING MotionFactory: unknown curve type '%s' "
"(motion_id=%s)\n", cmd.curve_type.c_str(), cmd.motion_id.c_str());
GME_LOG_WARNING("MotionFactory: unknown curve type '" + cmd.curve_type
+ "' (motion_id=" + cmd.motion_id + ")");
ctx.emitStatus(gme::signal::StatusKind::MotionError,
cmd.motion_id, "unknown_curve_type");
return nullptr;
Expand All @@ -49,9 +50,9 @@ static std::unique_ptr<IMotion> makeFadeMotion(const gme::signal::FadeCommand& c
// Build lo_address
lo_address addr = gme::osc::makeAddress(cmd.osc_host, cmd.osc_port);
if (!addr) {
std::fprintf(stderr, "WARNING MotionFactory: lo_address_new failed for "
"%s:%d (motion_id=%s)\n",
cmd.osc_host.c_str(), cmd.osc_port, cmd.motion_id.c_str());
GME_LOG_WARNING("MotionFactory: lo_address_new failed for " + cmd.osc_host
+ ":" + std::to_string(cmd.osc_port)
+ " (motion_id=" + cmd.motion_id + ")");
ctx.emitStatus(gme::signal::StatusKind::MotionError,
cmd.motion_id, "osc_address_failed");
return nullptr;
Expand Down Expand Up @@ -82,8 +83,8 @@ std::unique_ptr<IMotion> MotionFactory::fromCommand(const gme::signal::FadeComma

case Type::START_CROSSFADE:
// TODO Phase 7: return makeCrossfadePair(cmd, ctx);
std::fprintf(stderr, "INFO MotionFactory: START_CROSSFADE not yet "
"implemented (motion_id=%s)\n", cmd.motion_id.c_str());
GME_LOG_INFO("MotionFactory: START_CROSSFADE not yet implemented (motion_id="
+ cmd.motion_id + ")");
return nullptr;

default:
Expand Down
10 changes: 5 additions & 5 deletions src/motion/MotionRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <algorithm>
#include <cstdio>
#include <vector>
#include "daemon/logging.h"

namespace gme {
namespace motion {
Expand Down Expand Up @@ -89,9 +90,8 @@ void MotionRegistry::apply(gme::signal::FadeCommand& cmd) {
cancelAll();
break;
case Type::START_CROSSFADE:
std::fprintf(stderr, "INFO MotionRegistry: START_CROSSFADE dropped "
"(deferred to future feature, motion_id=%s)\n",
cmd.motion_id.c_str());
GME_LOG_INFO("MotionRegistry: START_CROSSFADE dropped (deferred to "
"future feature, motion_id=" + cmd.motion_id + ")");
break;
}
}
Expand Down Expand Up @@ -137,8 +137,8 @@ void MotionRegistry::addMotion(std::unique_ptr<IMotion> m) {
void MotionRegistry::cancelMotion(const std::string& motion_id, bool snap_to_end) {
auto it = motions_.find(motion_id);
if (it == motions_.end()) {
std::fprintf(stderr, "WARNING MotionRegistry: cancelMotion: motion_id '%s' "
"not found\n", motion_id.c_str());
GME_LOG_WARNING("MotionRegistry: cancelMotion: motion_id '" + motion_id
+ "' not found");
return;
}

Expand Down
Loading