mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-22 16:33:17 +00:00
41bdcd4aed
* Update logging * Remove duplicate code * Update unit tests * Clean up includes * Merge ProtobufSerializer into protobuf_util namespace * Precompile regex * Add const * Add Split() convenience method, update log level/ID parsing * Move log.h to legacy folder * Elimininate gotos * Fixes for gcc 13 * Update compiler flags * Update default folder handling * Use references instead of pointers * Move code for better encapsulation * Move code * Remove unused method argument * Move device logger * Remove redundant to_string * Rename for consistency * Update handling of protobuf pointers * Simplify protobuf usage * Memory handling update * Add hasher
32 lines
1.0 KiB
C
32 lines
1.0 KiB
C
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Powered by XM6 TypeG Technology.
|
|
// Copyright (C) 2016-2020 GIMONS
|
|
// Copyright (C) 2020 akuker
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
// The legacy code in this file is deprecated and can cause a buffer overflow. Use spdlog directly instead.
|
|
|
|
#pragma once
|
|
|
|
#include <spdlog/spdlog.h>
|
|
|
|
static const int LOGBUF_SIZE = 512;
|
|
|
|
#define SPDLOGWRAPPER(loglevel, ...) \
|
|
{ \
|
|
char logbuf[LOGBUF_SIZE]; \
|
|
snprintf(logbuf, sizeof(logbuf), __VA_ARGS__); \
|
|
spdlog::log(loglevel, logbuf); \
|
|
};
|
|
|
|
#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__)
|