@@ -109,13 +109,73 @@ class SequencedTaskRunner;
109
109
110
110
namespace fly ::logger {
111
111
112
+ class Logger ;
112
113
class LoggerConfig ;
113
114
class Sink ;
114
115
115
116
namespace detail {
116
117
class Registry ;
117
118
} // namespace detail
118
119
120
+ /* *
121
+ * Create a synchronous file logger.
122
+ *
123
+ * @param name Name of the logger to create.
124
+ * @param logger_config Reference to the logger configuration.
125
+ * @param coder_config Reference to the coder configuration.
126
+ * @param logger_directory Path to store log files.
127
+ *
128
+ * @return The created logger, or null if the logger could not be initialized.
129
+ */
130
+ std::shared_ptr<Logger> create_file_logger (
131
+ std::string name,
132
+ std::shared_ptr<LoggerConfig> logger_config,
133
+ std::shared_ptr<fly::coders::CoderConfig> coder_config,
134
+ std::filesystem::path logger_directory);
135
+
136
+ /* *
137
+ * Create an asynchronous file logger.
138
+ *
139
+ * @param name Name of the logger to create.
140
+ * @param task_runner The sequence on which logs are streamed.
141
+ * @param logger_config Reference to the logger configuration.
142
+ * @param coder_config Reference to the coder configuration.
143
+ * @param logger_directory Path to store log files.
144
+ *
145
+ * @return The created logger, or null if the logger could not be initialized.
146
+ */
147
+ std::shared_ptr<Logger> create_file_logger (
148
+ std::string name,
149
+ std::shared_ptr<fly::task::SequencedTaskRunner> task_runner,
150
+ std::shared_ptr<LoggerConfig> logger_config,
151
+ std::shared_ptr<fly::coders::CoderConfig> coder_config,
152
+ std::filesystem::path logger_directory);
153
+
154
+ /* *
155
+ * Create a synchronous console logger.
156
+ *
157
+ * @param name Name of the logger to create.
158
+ * @param logger_config Reference to the logger configuration.
159
+ *
160
+ * @return The created logger, or null if the logger could not be initialized.
161
+ */
162
+ std::shared_ptr<Logger>
163
+ create_console_logger (std::string name, std::shared_ptr<LoggerConfig> logger_config);
164
+
165
+ /* *
166
+ * Create an asynchronous console logger.
167
+ *
168
+ * @param name Name of the logger to create.
169
+ * @param task_runner The sequence on which logs are streamed.
170
+ * @param logger_config Reference to the logger configuration.
171
+ *
172
+ * @return The created logger, or null if the logger could not be initialized.
173
+ */
174
+ std::shared_ptr<Logger> create_console_logger (
175
+ std::string name,
176
+ std::shared_ptr<fly::task::SequencedTaskRunner> task_runner,
177
+ std::shared_ptr<LoggerConfig> logger_config);
178
+
119
179
/* *
120
180
* Logging class to provide configurable instrumentation. There are 4 levels of instrumentation:
121
181
*
@@ -159,7 +219,7 @@ class Logger : public std::enable_shared_from_this<Logger>
159
219
*
160
220
* @return The created logger, or null if the logger could not be initialized.
161
221
*/
162
- static std::shared_ptr<Logger> create_logger (
222
+ static std::shared_ptr<Logger> create (
163
223
std::string name,
164
224
std::shared_ptr<LoggerConfig> logger_config,
165
225
std::unique_ptr<Sink> &&sink);
@@ -174,71 +234,12 @@ class Logger : public std::enable_shared_from_this<Logger>
174
234
*
175
235
* @return The created logger, or null if the logger could not be initialized.
176
236
*/
177
- static std::shared_ptr<Logger> create_logger (
237
+ static std::shared_ptr<Logger> create (
178
238
std::string name,
179
239
std::shared_ptr<fly::task::SequencedTaskRunner> task_runner,
180
240
std::shared_ptr<LoggerConfig> logger_config,
181
241
std::unique_ptr<Sink> &&sink);
182
242
183
- /* *
184
- * Create a synchronous file logger.
185
- *
186
- * @param name Name of the logger to create.
187
- * @param logger_config Reference to the logger configuration.
188
- * @param coder_config Reference to the coder configuration.
189
- * @param logger_directory Path to store log files.
190
- *
191
- * @return The created logger, or null if the logger could not be initialized.
192
- */
193
- static std::shared_ptr<Logger> create_file_logger (
194
- std::string name,
195
- std::shared_ptr<LoggerConfig> logger_config,
196
- std::shared_ptr<fly::coders::CoderConfig> coder_config,
197
- std::filesystem::path logger_directory);
198
-
199
- /* *
200
- * Create an asynchronous file logger.
201
- *
202
- * @param name Name of the logger to create.
203
- * @param task_runner The sequence on which logs are streamed.
204
- * @param logger_config Reference to the logger configuration.
205
- * @param coder_config Reference to the coder configuration.
206
- * @param logger_directory Path to store log files.
207
- *
208
- * @return The created logger, or null if the logger could not be initialized.
209
- */
210
- static std::shared_ptr<Logger> create_file_logger (
211
- std::string name,
212
- std::shared_ptr<fly::task::SequencedTaskRunner> task_runner,
213
- std::shared_ptr<LoggerConfig> logger_config,
214
- std::shared_ptr<fly::coders::CoderConfig> coder_config,
215
- std::filesystem::path logger_directory);
216
-
217
- /* *
218
- * Create a synchronous console logger.
219
- *
220
- * @param name Name of the logger to create.
221
- * @param logger_config Reference to the logger configuration.
222
- *
223
- * @return The created logger, or null if the logger could not be initialized.
224
- */
225
- static std::shared_ptr<Logger>
226
- create_console_logger (std::string name, std::shared_ptr<LoggerConfig> logger_config);
227
-
228
- /* *
229
- * Create an asynchronous console logger.
230
- *
231
- * @param name Name of the logger to create.
232
- * @param task_runner The sequence on which logs are streamed.
233
- * @param logger_config Reference to the logger configuration.
234
- *
235
- * @return The created logger, or null if the logger could not be initialized.
236
- */
237
- static std::shared_ptr<Logger> create_console_logger (
238
- std::string name,
239
- std::shared_ptr<fly::task::SequencedTaskRunner> task_runner,
240
- std::shared_ptr<LoggerConfig> logger_config);
241
-
242
243
/* *
243
244
* Set the default logger instance for the LOG* macro functions. If the provided logger is null,
244
245
* the default logger is reset to the initial synchronous console logger.
0 commit comments