Skip to content

Commit

Permalink
refactor: retire deprecated stream_logger ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
mhx committed Dec 28, 2023
1 parent a2cd96f commit 346e408
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
4 changes: 0 additions & 4 deletions include/dwarfs/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ class stream_logger : public logger {
stream_logger(std::shared_ptr<terminal const> term, std::ostream& os,
level_type threshold = WARN, bool with_context = false);

[[deprecated]] stream_logger(std::ostream& os = std::cerr,
level_type threshold = WARN,
bool with_context = false);

void write(level_type level, const std::string& output, char const* file,
int line) override;

Expand Down
4 changes: 0 additions & 4 deletions src/dwarfs/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ stream_logger::stream_logger(std::shared_ptr<terminal const> term,
set_threshold(threshold);
}

stream_logger::stream_logger(std::ostream& os, level_type threshold,
bool with_context)
: stream_logger{terminal::create(), os, threshold, with_context} {}

void stream_logger::preamble() {}
void stream_logger::postamble() {}
std::string_view stream_logger::get_newline() const { return "\n"; }
Expand Down
11 changes: 5 additions & 6 deletions test/dwarfs_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "dwarfs/worker_group.h"
#include "mmap_mock.h"
#include "test_helpers.h"
#include "test_logger.h"
#include "test_strings.h"

#include "dwarfs/gen-cpp2/metadata_layouts.h"
Expand Down Expand Up @@ -117,9 +118,7 @@ std::string make_filesystem(::benchmark::State const& state) {
worker_group wg("writer", 4);
progress prog([](const progress&, bool) {}, 1000);

std::ostringstream logss;
stream_logger lgr(logss); // TODO: mock
lgr.set_policy<prod_logger_policy>();
test::test_logger lgr;

auto sf = std::make_shared<segmenter_factory>(lgr, prog, cfg);

Expand Down Expand Up @@ -170,7 +169,7 @@ void frozen_string_table_lookup(::benchmark::State& state) {
auto data = make_frozen_string_table(
test::test_strings,
string_table::pack_options(state.range(0), state.range(1), true));
stream_logger lgr;
test::test_logger lgr;
string_table table(lgr, "bench", data);
int i = 0;
std::string str;
Expand All @@ -182,7 +181,7 @@ void frozen_string_table_lookup(::benchmark::State& state) {

void dwarfs_initialize(::benchmark::State& state) {
auto image = make_filesystem(state);
stream_logger lgr;
test::test_logger lgr;
auto mm = std::make_shared<test::mmap_mock>(image);
filesystem_options opts;
opts.block_cache.max_bytes = 1 << 20;
Expand Down Expand Up @@ -283,7 +282,7 @@ class filesystem : public ::benchmark::Fixture {
std::vector<inode_view> entries;

private:
stream_logger lgr;
test::test_logger lgr;
std::string image;
std::shared_ptr<mmif> mm;
};
Expand Down

0 comments on commit 346e408

Please sign in to comment.