|
17 | 17 | #include "Syncd.h"
|
18 | 18 | #include "RequestShutdown.h"
|
19 | 19 | #include "ComparisonLogic.h"
|
| 20 | +#include "MetadataLogger.h" |
20 | 21 |
|
21 | 22 | #include "meta/sai_serialize.h"
|
22 | 23 |
|
|
27 | 28 | #include "swss/table.h"
|
28 | 29 | #include "swss/redisapi.h"
|
29 | 30 |
|
30 |
| - |
31 | 31 | #include <inttypes.h>
|
32 | 32 | #include <limits.h>
|
33 | 33 |
|
@@ -247,62 +247,6 @@ void set_sai_api_log_min_prio(const std::string &prioStr)
|
247 | 247 | }
|
248 | 248 | }
|
249 | 249 |
|
250 |
| -void sai_meta_log_syncd( |
251 |
| - _In_ sai_log_level_t log_level, |
252 |
| - _In_ const char *file, |
253 |
| - _In_ int line, |
254 |
| - _In_ const char *func, |
255 |
| - _In_ const char *format, |
256 |
| - ...) |
257 |
| - __attribute__ ((format (printf, 5, 6))); |
258 |
| - |
259 |
| -void sai_meta_log_syncd( |
260 |
| - _In_ sai_log_level_t log_level, |
261 |
| - _In_ const char *file, |
262 |
| - _In_ int line, |
263 |
| - _In_ const char *func, |
264 |
| - _In_ const char *format, |
265 |
| - ...) |
266 |
| -{ |
267 |
| - // SWSS_LOG_ENTER() is omitted since this is logging for metadata |
268 |
| - |
269 |
| - char buffer[0x1000]; |
270 |
| - |
271 |
| - va_list ap; |
272 |
| - va_start(ap, format); |
273 |
| - vsnprintf(buffer, 0x1000, format, ap); |
274 |
| - va_end(ap); |
275 |
| - |
276 |
| - swss::Logger::Priority p = swss::Logger::SWSS_NOTICE; |
277 |
| - |
278 |
| - switch (log_level) |
279 |
| - { |
280 |
| - case SAI_LOG_LEVEL_DEBUG: |
281 |
| - p = swss::Logger::SWSS_DEBUG; |
282 |
| - break; |
283 |
| - case SAI_LOG_LEVEL_INFO: |
284 |
| - p = swss::Logger::SWSS_INFO; |
285 |
| - break; |
286 |
| - case SAI_LOG_LEVEL_ERROR: |
287 |
| - p = swss::Logger::SWSS_ERROR; |
288 |
| - fprintf(stderr, "ERROR: %s: %s", func, buffer); |
289 |
| - break; |
290 |
| - case SAI_LOG_LEVEL_WARN: |
291 |
| - p = swss::Logger::SWSS_WARN; |
292 |
| - fprintf(stderr, "WARN: %s: %s", func, buffer); |
293 |
| - break; |
294 |
| - case SAI_LOG_LEVEL_CRITICAL: |
295 |
| - p = swss::Logger::SWSS_CRIT; |
296 |
| - break; |
297 |
| - |
298 |
| - default: |
299 |
| - p = swss::Logger::SWSS_NOTICE; |
300 |
| - break; |
301 |
| - } |
302 |
| - |
303 |
| - swss::Logger::getInstance().write(p, ":- %s: %s", func, buffer); |
304 |
| -} |
305 |
| - |
306 | 250 | void timerWatchdogCallback(
|
307 | 251 | _In_ int64_t span)
|
308 | 252 | {
|
@@ -361,10 +305,7 @@ int syncd_main(int argc, char **argv)
|
361 | 305 |
|
362 | 306 | g_handler->setSwitchNotifications(sn.getSwitchNotifications());
|
363 | 307 |
|
364 |
| -#pragma GCC diagnostic push |
365 |
| -#pragma GCC diagnostic ignored "-Wsuggest-attribute=format" |
366 |
| - sai_metadata_log = &sai_meta_log_syncd; |
367 |
| -#pragma GCC diagnostic pop |
| 308 | + MetadataLogger::initialize(); |
368 | 309 |
|
369 | 310 | // TODO move to syncd object
|
370 | 311 | g_commandLineOptions = CommandLineOptionsParser::parseCommandLine(argc, argv);
|
|
0 commit comments