Skip to content

Commit

Permalink
Merge pull request #278 from paulsengroup/fix/logging
Browse files Browse the repository at this point in the history
Tweak max active log level based on CMake build type
  • Loading branch information
robomics authored Oct 6, 2024
2 parents f3aa250 + 7ea2d84 commit 7282aba
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/hictk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ target_sources(
${CMAKE_CURRENT_SOURCE_DIR}/zoomify/mcool.cpp
${CMAKE_CURRENT_SOURCE_DIR}/zoomify/zoomify.cpp)

target_compile_definitions(hictk PRIVATE SPDLOG_ACTIVE_LEVEL=$<IF:$<CONFIG:Debug>,SPDLOG_LEVEL_DEBUG,SPDLOG_LEVEL_INFO>)
target_include_directories(hictk PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(hictk PRIVATE hictk_project_options hictk_project_warnings hictk::libhictk)

Expand Down
1 change: 1 addition & 0 deletions src/hictk/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ static void setup_logger_console() {
}

static void setup_logger_console(int verbosity_lvl, bool print_version) {
spdlog::set_level(spdlog::level::level_enum(verbosity_lvl));
for (auto& sink : spdlog::default_logger()->sinks()) {
sink->set_level(spdlog::level::level_enum(verbosity_lvl));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _plan_tests_cmd(
) -> List[ImmutableOrderedDict]:
assert threads > 0
plans = []
factory = {"hictk_bin": str(hictk_bin), "title": title, "timeout": 60.0}
factory = {"hictk_bin": str(hictk_bin), "title": title, "timeout": 90.0}
for c in config["test-cases"]:
cwd = wd.mkdtemp(wd.name / title)
tmpdir = wd.mkdir(cwd / "tmp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ def log_output(data, label):
if not isinstance(data, list):
data = [data]

for line in data:
i = min(500, len(data))
for line in data[-i:]:
logging.warning(f"{label}: {line.strip()}")

log_output(stdout.result(5.0), "stdout")
Expand Down

0 comments on commit 7282aba

Please sign in to comment.