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,23 +142,47 @@ 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& stream, const IdentifierHash& id_hash) noexcept(false)
{
const auto& reg = IdentifierHash::get_registry();
const auto it = reg.find(id_hash.data());
if (it != reg.end())
{
stream << it->second;
}
else
{
stream << "<Unknown IdentifierHash: " << id_hash.data() << ">";
}
return stream;
}

} // namespace score::lcm

#ifdef LC_LOG_SCORE_MW_LOG
Comment thread
MaciejKaszynski marked this conversation as resolved.
#include "score/mw/log/logger.h"

namespace score::lcm
{

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

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

} // namespace score
#endif // LC_LOG_SCORE_MW_LOG

#endif // IDENTIFIER_HASH_H_
Loading
Loading