2018-05-03 15:47:57 +02:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2022-12-05 09:58:23 -08:00
|
|
|
// SCSI Target Emulator PiSCSI
|
2018-05-03 15:47:57 +02:00
|
|
|
// for Raspberry Pi
|
|
|
|
//
|
|
|
|
// Powered by XM6 TypeG Technology.
|
2020-07-04 09:57:44 -05:00
|
|
|
// Copyright (C) 2016-2020 GIMONS
|
2020-10-19 07:31:06 -05:00
|
|
|
// Copyright (C) 2020 akuker
|
2018-05-03 15:47:57 +02:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2023-10-15 08:38:15 +02:00
|
|
|
// The legacy code in this file is deprecated and can cause a buffer overflow. Use spdlog directly instead.
|
|
|
|
|
2022-09-25 23:49:24 +02:00
|
|
|
#pragma once
|
2018-05-03 15:47:57 +02:00
|
|
|
|
2023-10-15 08:38:15 +02:00
|
|
|
#include <spdlog/spdlog.h>
|
2020-10-19 07:31:06 -05:00
|
|
|
|
2022-09-25 23:49:24 +02:00
|
|
|
static const int LOGBUF_SIZE = 512;
|
|
|
|
|
2021-02-07 13:00:48 -06:00
|
|
|
#define SPDLOGWRAPPER(loglevel, ...) \
|
|
|
|
{ \
|
2022-09-25 23:49:24 +02:00
|
|
|
char logbuf[LOGBUF_SIZE]; \
|
2021-02-07 13:00:48 -06:00
|
|
|
snprintf(logbuf, sizeof(logbuf), __VA_ARGS__); \
|
|
|
|
spdlog::log(loglevel, logbuf); \
|
2021-05-23 14:44:34 -05:00
|
|
|
};
|
2020-10-19 07:31:06 -05:00
|
|
|
|
2021-02-07 13:00:48 -06:00
|
|
|
#define LOGTRACE(...) SPDLOGWRAPPER(spdlog::level::trace, __VA_ARGS__)
|
|
|
|
#define LOGDEBUG(...) SPDLOGWRAPPER(spdlog::level::debug, __VA_ARGS__)
|
|
|
|
#define LOGINFO(...) SPDLOGWRAPPER(spdlog::level::info, __VA_ARGS__)
|
|
|
|
#define LOGWARN(...) SPDLOGWRAPPER(spdlog::level::warn, __VA_ARGS__)
|
|
|
|
#define LOGERROR(...) SPDLOGWRAPPER(spdlog::level::err, __VA_ARGS__)
|