-
Notifications
You must be signed in to change notification settings - Fork 928
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use new rapids-logger library (#17899)
Contributes to rapidsai/build-planning#104. Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Matthew Murray (https://github.com/Matt711) - Gil Forsyth (https://github.com/gforsyth) - Bradley Dice (https://github.com/bdice) - James Lamb (https://github.com/jameslamb) URL: #17899
- Loading branch information
Showing
17 changed files
with
134 additions
and
121 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
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
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 was deleted.
Oops, something went wrong.
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,50 @@ | ||
/* | ||
* Copyright (c) 2025, NVIDIA CORPORATION. | ||
* | ||
* 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 <cudf/logger_macros.hpp> | ||
#include <cudf/utilities/export.hpp> | ||
|
||
#include <rapids_logger/logger.hpp> | ||
|
||
namespace CUDF_EXPORT cudf { | ||
|
||
/** | ||
* @brief Returns the default sink for the global logger. | ||
* | ||
* If the environment variable `CUDF_DEBUG_LOG_FILE` is defined, the default sink is a sink to that | ||
* file. Otherwise, the default is to dump to stderr. | ||
* | ||
* @return sink_ptr The sink to use | ||
*/ | ||
rapids_logger::sink_ptr default_logger_sink(); | ||
|
||
/** | ||
* @brief Returns the default log pattern for the global logger. | ||
* | ||
* @return std::string The default log pattern. | ||
*/ | ||
std::string default_logger_pattern(); | ||
|
||
/** | ||
* @brief Get the default logger. | ||
* | ||
* @return logger& The default logger | ||
*/ | ||
rapids_logger::logger& default_logger(); | ||
|
||
} // namespace CUDF_EXPORT cudf |
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,46 @@ | ||
/* | ||
* Copyright (c) 2025, NVIDIA CORPORATION. | ||
* | ||
* 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. | ||
*/ | ||
|
||
#include <cudf/logger.hpp> | ||
#include <cudf/utilities/export.hpp> | ||
|
||
#include <rapids_logger/logger.hpp> | ||
|
||
namespace CUDF_EXPORT cudf { | ||
|
||
rapids_logger::sink_ptr default_logger_sink() | ||
{ | ||
auto* filename = std::getenv("CUDF_DEBUG_LOG_FILE"); | ||
if (filename != nullptr) { | ||
return std::make_shared<rapids_logger::basic_file_sink_mt>(filename, true); | ||
} | ||
return std::make_shared<rapids_logger::stderr_sink_mt>(); | ||
} | ||
|
||
std::string default_logger_pattern() { return "[%6t][%H:%M:%S:%f][%-6l] %v"; } | ||
|
||
rapids_logger::logger& default_logger() | ||
{ | ||
static rapids_logger::logger logger_ = [] { | ||
rapids_logger::logger logger_{"CUDF", {default_logger_sink()}}; | ||
logger_.set_pattern(default_logger_pattern()); | ||
logger_.set_level(rapids_logger::level_enum::warn); | ||
return logger_; | ||
}(); | ||
return logger_; | ||
} | ||
|
||
} // namespace CUDF_EXPORT cudf |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.