Skip to content

Commit b269104

Browse files
committed
Rename fly::logger::LogSink as fly::logger::Sink
Now that it's in a nested namespace, the extra "Log" in the name is a bit verbose.
1 parent 72211c4 commit b269104

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

bench/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#include "fly/logger/log_sink.hpp"
21
#include "fly/logger/logger.hpp"
32
#include "fly/logger/logger_config.hpp"
3+
#include "fly/logger/sink.hpp"
44
#include "fly/logger/styler.hpp"
55
#include "fly/types/string/string.hpp"
66

@@ -19,7 +19,7 @@
1919
/**
2020
* Log sink to drop all received logs.
2121
*/
22-
class DropSink : public fly::logger::LogSink
22+
class DropSink : public fly::logger::Sink
2323
{
2424
public:
2525
bool initialize() override

build/win/libfly/libfly.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@
175175
<ClInclude Include="..\..\..\fly\logger\detail\styler_proxy.hpp" />
176176
<ClInclude Include="..\..\..\fly\logger\detail\win\styler_proxy_impl.hpp" />
177177
<ClInclude Include="..\..\..\fly\logger\log.hpp" />
178-
<ClInclude Include="..\..\..\fly\logger\log_sink.hpp" />
179178
<ClInclude Include="..\..\..\fly\logger\logger.hpp" />
180179
<ClInclude Include="..\..\..\fly\logger\logger_config.hpp" />
180+
<ClInclude Include="..\..\..\fly\logger\sink.hpp" />
181181
<ClInclude Include="..\..\..\fly\logger\styler.hpp" />
182182
<ClInclude Include="..\..\..\fly\net\endpoint.hpp" />
183183
<ClInclude Include="..\..\..\fly\net\ipv4_address.hpp" />

build/win/libfly/libfly.vcxproj.filters

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
<ClInclude Include="..\..\..\fly\logger\logger_config.hpp">
125125
<Filter>logger</Filter>
126126
</ClInclude>
127-
<ClInclude Include="..\..\..\fly\logger\log_sink.hpp">
127+
<ClInclude Include="..\..\..\fly\logger\sink.hpp">
128128
<Filter>logger</Filter>
129129
</ClInclude>
130130
<ClInclude Include="..\..\..\fly\logger\styler.hpp">

fly/logger/detail/console_sink.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "fly/logger/log_sink.hpp"
3+
#include "fly/logger/sink.hpp"
44

55
namespace fly::logger {
66
struct Log;
@@ -15,7 +15,7 @@ namespace fly::logger::detail {
1515
* @author Timothy Flynn ([email protected])
1616
* @version October 11, 2020
1717
*/
18-
class ConsoleSink : public fly::logger::LogSink
18+
class ConsoleSink : public fly::logger::Sink
1919
{
2020
public:
2121
/**

fly/logger/detail/file_sink.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "fly/logger/log_sink.hpp"
3+
#include "fly/logger/sink.hpp"
44

55
#include <cstdint>
66
#include <filesystem>
@@ -25,7 +25,7 @@ namespace fly::logger::detail {
2525
* @author Timothy Flynn ([email protected])
2626
* @version October 11, 2020
2727
*/
28-
class FileSink : public fly::logger::LogSink
28+
class FileSink : public fly::logger::Sink
2929
{
3030
public:
3131
/**

fly/logger/logger.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include "fly/logger/detail/file_sink.hpp"
66
#include "fly/logger/detail/registry.hpp"
77
#include "fly/logger/log.hpp"
8-
#include "fly/logger/log_sink.hpp"
98
#include "fly/logger/logger_config.hpp"
9+
#include "fly/logger/sink.hpp"
1010
#include "fly/task/task_runner.hpp"
1111

1212
namespace fly::logger {
@@ -16,7 +16,7 @@ Logger::Logger(
1616
std::string name,
1717
std::shared_ptr<fly::task::SequencedTaskRunner> task_runner,
1818
std::shared_ptr<LoggerConfig> config,
19-
std::unique_ptr<LogSink> &&sink) noexcept :
19+
std::unique_ptr<Sink> &&sink) noexcept :
2020
m_name(std::move(name)),
2121
m_config(std::move(config)),
2222
m_sink(std::move(sink)),
@@ -35,7 +35,7 @@ Logger::~Logger()
3535
std::shared_ptr<Logger> Logger::create_logger(
3636
std::string name,
3737
std::shared_ptr<LoggerConfig> logger_config,
38-
std::unique_ptr<LogSink> &&sink)
38+
std::unique_ptr<Sink> &&sink)
3939
{
4040
return create_logger(std::move(name), nullptr, std::move(logger_config), std::move(sink));
4141
}
@@ -45,7 +45,7 @@ std::shared_ptr<Logger> Logger::create_logger(
4545
std::string name,
4646
std::shared_ptr<fly::task::SequencedTaskRunner> task_runner,
4747
std::shared_ptr<LoggerConfig> logger_config,
48-
std::unique_ptr<LogSink> &&sink)
48+
std::unique_ptr<Sink> &&sink)
4949
{
5050
// Logger has a private constructor, thus cannot be used with std::make_shared. This class is
5151
// used to expose the private constructor locally.
@@ -55,7 +55,7 @@ std::shared_ptr<Logger> Logger::create_logger(
5555
std::string &&name,
5656
std::shared_ptr<fly::task::SequencedTaskRunner> &&task_runner,
5757
std::shared_ptr<LoggerConfig> &&logger_config,
58-
std::unique_ptr<LogSink> &&sink) noexcept :
58+
std::unique_ptr<Sink> &&sink) noexcept :
5959
Logger(
6060
std::move(name),
6161
std::move(task_runner),

fly/logger/logger.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class SequencedTaskRunner;
110110
namespace fly::logger {
111111

112112
class LoggerConfig;
113-
class LogSink;
113+
class Sink;
114114

115115
namespace detail {
116116
class Registry;
@@ -162,7 +162,7 @@ class Logger : public std::enable_shared_from_this<Logger>
162162
static std::shared_ptr<Logger> create_logger(
163163
std::string name,
164164
std::shared_ptr<LoggerConfig> logger_config,
165-
std::unique_ptr<LogSink> &&sink);
165+
std::unique_ptr<Sink> &&sink);
166166

167167
/**
168168
* Create an asynchronous logger with the provided log sink.
@@ -178,7 +178,7 @@ class Logger : public std::enable_shared_from_this<Logger>
178178
std::string name,
179179
std::shared_ptr<fly::task::SequencedTaskRunner> task_runner,
180180
std::shared_ptr<LoggerConfig> logger_config,
181-
std::unique_ptr<LogSink> &&sink);
181+
std::unique_ptr<Sink> &&sink);
182182

183183
/**
184184
* Create a synchronous file logger.
@@ -449,7 +449,7 @@ class Logger : public std::enable_shared_from_this<Logger>
449449
std::string name,
450450
std::shared_ptr<fly::task::SequencedTaskRunner> task_runner,
451451
std::shared_ptr<LoggerConfig> config,
452-
std::unique_ptr<LogSink> &&sink) noexcept;
452+
std::unique_ptr<Sink> &&sink) noexcept;
453453

454454
/**
455455
* Initialize the log sink.
@@ -487,7 +487,7 @@ class Logger : public std::enable_shared_from_this<Logger>
487487
const std::string m_name;
488488

489489
std::shared_ptr<LoggerConfig> m_config;
490-
std::unique_ptr<LogSink> m_sink;
490+
std::unique_ptr<Sink> m_sink;
491491

492492
std::shared_ptr<fly::task::SequencedTaskRunner> m_task_runner;
493493
std::atomic_bool m_last_task_failed {true};

fly/logger/log_sink.hpp fly/logger/sink.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ struct Log;
1313
* @author Timothy Flynn ([email protected])
1414
* @version October 11, 2020
1515
*/
16-
class LogSink
16+
class Sink
1717
{
1818
public:
19-
virtual ~LogSink() = default;
19+
virtual ~Sink() = default;
2020

2121
/**
2222
* Initialize the sink. If initialization fails, the logger will not be started and will not

test/logger/logger.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#include "test/util/task_manager.hpp"
44

5-
#include "fly/logger/log_sink.hpp"
65
#include "fly/logger/logger_config.hpp"
6+
#include "fly/logger/sink.hpp"
77
#include "fly/task/task_manager.hpp"
88
#include "fly/task/task_runner.hpp"
99
#include "fly/types/concurrency/concurrent_queue.hpp"
@@ -25,7 +25,7 @@ namespace {
2525
/**
2626
* Test log sink to store received logs in a queue for verification.
2727
*/
28-
class QueueSink : public fly::logger::LogSink
28+
class QueueSink : public fly::logger::Sink
2929
{
3030
public:
3131
QueueSink(fly::ConcurrentQueue<fly::logger::Log> &logs) : m_logs(logs)
@@ -50,7 +50,7 @@ class QueueSink : public fly::logger::LogSink
5050
/**
5151
* Test log sink to drop all received logs.
5252
*/
53-
class DropSink : public fly::logger::LogSink
53+
class DropSink : public fly::logger::Sink
5454
{
5555
public:
5656
bool initialize() override
@@ -67,7 +67,7 @@ class DropSink : public fly::logger::LogSink
6767
/**
6868
* Test log sink to purposefully fail initialiation.
6969
*/
70-
class FailInitSink : public fly::logger::LogSink
70+
class FailInitSink : public fly::logger::Sink
7171
{
7272
public:
7373
bool initialize() override

0 commit comments

Comments
 (0)