Skip to content
Open
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
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module(
)

# Bazel global rules
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "rules_python", version = "1.8.5")
bazel_dep(name = "rules_rust", version = "0.68.1-score")
Expand Down
16 changes: 16 additions & 0 deletions config/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

config_setting(
name = "x86_64-linux",
define_values = {
Expand Down Expand Up @@ -52,3 +54,17 @@ config_setting(
name = "ub_sanitizer_enabled",
define_values = {"sanitize": "undefined"},
)

bool_flag(
name = "use_cout_log",
build_setting_default = False,
visibility = ["//visibility:public"],
)

config_setting(
name = "lm_use_cout_log",
flag_values = {
":use_cout_log": "True",
},
visibility = ["//visibility:public"],
)
1 change: 0 additions & 1 deletion src/control_client_lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ cc_library(
"//src/launch_manager_daemon/common:log",
"//src/launch_manager_daemon/common:osal",
"@score_baselibs//score/concurrency/future",
"@score_baselibs//score/mw/log",
],
)
8 changes: 8 additions & 0 deletions src/launch_manager_daemon/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,16 @@ cc_library(
cc_library(
name = "log",
hdrs = ["include/score/lcm/internal/log.hpp"],
defines = select({
"//config:lm_use_cout_log": [],
"//conditions:default": ["LC_LOG_SCORE_MW_LOG"],
}),
includes = ["include"],
visibility = ["//src:__subpackages__"],
deps = [] + select({
"//config:lm_use_cout_log": [],
"//conditions:default": ["@score_baselibs//score/mw/log"],
}),
)

cc_library(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
#define IDENTIFIER_HASH_H_

#include <cstddef>
#include <optional>
#include <ostream>
#include <sstream>
#include <string>
#include <string_view>
#include <unordered_map>

namespace score
{

namespace lcm
namespace score::lcm
{

/// @file identifier_hash.hpp
Expand Down Expand Up @@ -145,7 +142,7 @@ class IdentifierHash final
/// @param os The output stream.
/// @param id The IdentifierHash object to output.
/// @return A reference to the output stream.
inline std::ostream& operator<<(std::ostream& os, const IdentifierHash& id)
inline std::ostream& operator<<(std::ostream& os, const IdentifierHash& id) noexcept
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the noexcept correct?

{
const auto& reg = IdentifierHash::get_registry();
const auto it = reg.find(id.data());
Expand All @@ -160,8 +157,31 @@ inline std::ostream& operator<<(std::ostream& os, const IdentifierHash& id)
return os;
}

} // namespace lcm
} // namespace score::lcm

#if __has_include("score/mw/log/logger.h")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To toggle between std::cout logging and mw::log should be only controlled with bazel build options

#include "score/mw/log/logger.h"

namespace score::lcm
{

inline score::mw::log::LogStream& operator<<(score::mw::log::LogStream& log_stream, const IdentifierHash& id) noexcept
{
const auto& reg = IdentifierHash::get_registry();
const auto it = reg.find(id.data());
if (it != reg.end())
{
log_stream << it->second;
}
else
{
log_stream << "<Unknown IdentifierHash: " << id.data() << ">";
}
return log_stream;
}

} // namespace score::lcm

} // namespace score
#endif

#endif // IDENTIFIER_HASH_H_
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ enum class ProcessLimits : std::uint32_t {
maxLocalBuffSize = 32U ///< Maximum size for local buffer
};

// coverity[autosar_cpp14_a0_1_1_violation:INTENTIONAL] These are constants that are used globally.
constexpr std::uint32_t kCoreDumps = 1U; ///< Enable core dumps for managed processes (1 = enabled, 0 = disabled)

} // namespace lcm

} // namespace internal
Expand Down
Loading
Loading