Skip to content

Commit

Permalink
prepare for PR (match src/tateyama/altimeter/service/core.cpp to the …
Browse files Browse the repository at this point in the history
…status quo, etc.)
  • Loading branch information
t-horikawa committed Oct 30, 2024
1 parent 929780c commit 9754eab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 134 deletions.
124 changes: 0 additions & 124 deletions docs/altimeter-control-cli_ja.md

This file was deleted.

14 changes: 11 additions & 3 deletions src/tateyama/altimeter/service/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ using tateyama::api::server::response;
class altimeter_helper_direct : public altimeter_helper {
public:
void enable(std::string_view) override {
// FIXME not implemented in altimeter
// ::altimeter::logger::enable(t);
}
void disable(std::string_view) override {
// FIXME not implemented in altimeter
// ::altimeter::logger::disable(t);
}
void set_level(std::string_view t, std::uint64_t v) override {
::altimeter::logger::set_level(t, v);
Expand All @@ -53,8 +57,8 @@ bool tateyama::altimeter::service::core::operator()(const std::shared_ptr<reques

auto data = req->payload();
if(!rq.ParseFromArray(data.data(), static_cast<int>(data.size()))) {
LOG(ERROR) << "request parse error";
return false;
LOG(INFO) << "request parse error";
return true; // It indicates a possible malfunction in the communication system, but let's continue the operation.
}

res->session_id(req->session_id());
Expand All @@ -70,6 +74,8 @@ bool tateyama::altimeter::service::core::operator()(const std::shared_ptr<reques
} else {
helper_->disable("event");
}
send_error<tateyama::proto::altimeter::response::Configure>(res, tateyama::proto::altimeter::response::ErrorKind::UNKNOWN, "event log [enable|disable] is not implemented"); // FIXME remove this and the following lines
return true; // Error notification is treated as normal termination.
}
if (log_settings.level_opt_case() == tateyama::proto::altimeter::request::LogSettings::LevelOptCase::kLevel) {
auto v = log_settings.level();
Expand All @@ -88,6 +94,8 @@ bool tateyama::altimeter::service::core::operator()(const std::shared_ptr<reques
} else {
helper_->disable("audit");
}
send_error<tateyama::proto::altimeter::response::Configure>(res, tateyama::proto::altimeter::response::ErrorKind::UNKNOWN, "audit log [enable|disable] is not implemented"); // FIXME remove this and the following lines
return true; // Error notification is treated as normal termination.
}
if (log_settings.level_opt_case() == tateyama::proto::altimeter::request::LogSettings::LevelOptCase::kLevel) {
auto v = log_settings.level();
Expand All @@ -113,7 +121,7 @@ bool tateyama::altimeter::service::core::operator()(const std::shared_ptr<reques
break;
default:
send_error<tateyama::proto::altimeter::response::LogRotate>(res, tateyama::proto::altimeter::response::ErrorKind::UNKNOWN, "log type for LogRotate is invalid");
return false;
return true; // Error notification is treated as normal termination.
}
tateyama::proto::altimeter::response::LogRotate rs{};
(void) rs.mutable_success();
Expand Down
7 changes: 0 additions & 7 deletions src/tateyama/proto/altimeter/request.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ message LogSettings {
message Configure {

// configure event log, or keep the current settings.
//// oneof log_opt {
//// // configuration for event log.
//// LogSettings event_log = 1;
////
//// // configuration for audit log.
//// LogSettings audit_log = 2;
//// }
oneof event_log_opt {

// configuration for event log.
Expand Down

0 comments on commit 9754eab

Please sign in to comment.