mirror of
https://github.com/BotChain-Robots/rpc.git
synced 2026-03-09 23:12:27 +01:00
Prepare files for public release
This commit is contained in:
32
include/util/log.h
Normal file
32
include/util/log.h
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by sligh on 2026-01-09.
|
||||
//
|
||||
|
||||
#ifndef LOG_H
|
||||
#define LOG_H
|
||||
|
||||
#define ERRBUF_SIZE 300
|
||||
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
void print_errno() {
|
||||
char errbuf[ERRBUF_SIZE];
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, errbuf, sizeof(errbuf),
|
||||
NULL);
|
||||
spdlog::error("{}", errbuf);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
void print_errno() {
|
||||
spdlog::error("{}", strerror(errno));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif //LOG_H
|
||||
Reference in New Issue
Block a user