Skip to content

Commit bdf37ff

Browse files
committed
file_writer: Move to ulog::file namespace
1 parent 30348e5 commit bdf37ff

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

examples/unix/ulog_example_rotate_file.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void OutputFunc() {
3939
}
4040

4141
int main() {
42-
std::unique_ptr<ulog::WriterInterface> file_writer = std::make_unique<ulog::FileLimitWriter>(100 * 1024);
42+
std::unique_ptr<ulog::file::WriterInterface> file_writer = std::make_unique<ulog::file::FileLimitWriter>(100 * 1024);
4343
ulog::file::AsyncRotatingFile<ulog::mpsc::Mq> async_rotate(std::move(file_writer), 65536 * 2, "/tmp/ulog/test.txt", 5,
4444
true, std::chrono::seconds{1}, ulog::file::kRename);
4545

include/ulog/file/file_writer.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "file.h"
88
#include "writer_interface.h"
99

10-
namespace ulog {
10+
namespace ulog::file {
1111

1212
class FileLimitWriter final : public WriterInterface {
1313
public:
@@ -77,4 +77,4 @@ class FileLimitWriter final : public WriterInterface {
7777
std::FILE *file_{nullptr};
7878
size_t file_write_size_{0};
7979
};
80-
} // namespace ulog
80+
} // namespace ulog::file

include/ulog/file/writer_interface.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include "ulog/status.h"
1010

11-
namespace ulog {
11+
namespace ulog::file {
1212

1313
class WriterInterface {
1414
public:
@@ -51,4 +51,4 @@ class WriterInterface {
5151
*/
5252
virtual Status Write(const void* data, std::size_t len) = 0;
5353
};
54-
} // namespace ulog
54+
} // namespace ulog::file

include/ulog/file/zstd_file_writer.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "file.h"
88
#include "writer_interface.h"
99

10-
namespace ulog {
10+
namespace ulog::file {
1111

1212
class ZstdLimitFile final : public WriterInterface {
1313
public:
@@ -143,4 +143,4 @@ class ZstdLimitFile final : public WriterInterface {
143143
std::vector<uint8_t> zstd_out_buffer_;
144144
};
145145

146-
} // namespace ulog
146+
} // namespace ulog::file

tools/logrotate/logrotate.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int main(const int argc, char *argv[]) {
7070
const auto flush_interval = to_chrono_time(args_info.flush_interval_arg);
7171
std::string filepath = args_info.file_path_arg;
7272

73-
std::unique_ptr<ulog::WriterInterface> file_writer;
73+
std::unique_ptr<ulog::file::WriterInterface> file_writer;
7474
// Zstd compression
7575
if (args_info.zstd_compress_flag) {
7676
// Append .zst extension if not present
@@ -81,20 +81,20 @@ int main(const int argc, char *argv[]) {
8181
// Parse zstd parameters
8282
if (args_info.zstd_params_given) {
8383
const std::map<std::string, std::string> result = ParseParametersMap(args_info.zstd_params_arg);
84-
file_writer = std::make_unique<ulog::ZstdLimitFile>(
84+
file_writer = std::make_unique<ulog::file::ZstdLimitFile>(
8585
file_size, result.count("level") ? std::stoi(result.at("level")) : ZSTD_DEFAULT_LEVEL,
8686
result.count("window-log") ? std::stoi(result.at("window-log")) : 0,
8787
result.count("chain-log") ? std::stoi(result.at("chain-log")) : 0,
8888
result.count("hash-log") ? std::stoi(result.at("hash-log")) : 0);
8989

9090
// No zstd parameters
9191
} else {
92-
file_writer = std::make_unique<ulog::ZstdLimitFile>(file_size);
92+
file_writer = std::make_unique<ulog::file::ZstdLimitFile>(file_size);
9393
}
9494

9595
// No compression
9696
} else {
97-
file_writer = std::make_unique<ulog::FileLimitWriter>(file_size);
97+
file_writer = std::make_unique<ulog::file::FileLimitWriter>(file_size);
9898
}
9999

100100
const ulog::file::RotationStrategy rotation_strategy = std::string(args_info.rotation_strategy_arg) == "incremental"

0 commit comments

Comments
 (0)