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
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ use_repo(toolchains_qnx, "toolchains_qnx_sdp")
use_repo(toolchains_qnx, "toolchains_qnx_qcc")
use_repo(toolchains_qnx, "toolchains_qnx_ifs")

bazel_dep(name = "score_baselibs_rust", version = "0.0.3")
bazel_dep(name = "score_baselibs_rust", version = "0.0.4")
bazel_dep(name = "score_baselibs", version = "0.2.2")

# Hedron's Compile Commands Extractor for Bazel
Expand Down
4 changes: 2 additions & 2 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/health_monitoring_lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ cc_gtest_unit_test(
name = "cpp_tests",
srcs = [
"cpp/tests/health_monitor_test.cpp",
"cpp/tests/log_init.cpp",
],
linkopts = select({
"@platforms//os:qnx": ["-lsocket"],
"//conditions:default": [],
}),
deps = [
":health_monitoring_lib_cc",
"@score_baselibs_rust//src/log/stdout_logger_cpp_init",
],
)
44 changes: 44 additions & 0 deletions src/health_monitoring_lib/cpp/tests/log_init.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#include "score/mw/log/rust/stdout_logger_init.h"
#include <gtest/gtest.h>

/// Initializer for `StdoutLogger`.
/// This enables logging for Rust libraries.
class LogEnvironment final : public ::testing::Environment
{
protected:
void SetUp() override
{
using namespace score::mw::log::rust;

StdoutLoggerBuilder builder;
builder.Context("TEST")
.LogLevel(LogLevel::Verbose)
.ShowModule(false)
.ShowFile(true)
.ShowLine(true)
.SetAsDefaultLogger();
}
};

struct RegisterLogEnvironment
{
RegisterLogEnvironment()
{
::testing::AddGlobalTestEnvironment(new LogEnvironment());
}
};

static RegisterLogEnvironment register_log_environment;
Loading