-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cannot use spdlog because it has newliner
Signed-off-by: dentiny <[email protected]>
- Loading branch information
Showing
5 changed files
with
133 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2025 The Ray Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include <spdlog/sinks/base_sink.h> | ||
|
||
namespace ray { | ||
|
||
// Default formatter for spdlog appends newliner to content, [spdlog_noop_formatter] appends payload with no modification. | ||
class spdlog_noop_formatter : public spdlog::formatter { | ||
public: | ||
spdlog_noop_formatter() = default; | ||
~spdlog_noop_formatter() override = default; | ||
|
||
void format(const spdlog::details::log_msg &msg, spdlog::memory_buf_t &dest) override { | ||
spdlog::details::fmt_helper::append_string_view(msg.payload, dest); | ||
} | ||
|
||
std::unique_ptr<formatter> clone() const override { | ||
return std::make_unique<spdlog_noop_formatter>(); | ||
} | ||
}; | ||
|
||
} // namespace ray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters