spdlog API inteface for C #2147
Unanswered
viktorovichandrej
asked this question in
Q&A
Replies: 1 comment
-
There is no support. You can defined C API for yourself. Example:
#ifdef __cplusplus
extern "C" {
#endif
void setup_logger();
void log_info(char *msg);
void shutdown_logger();
#ifdef __cplusplus
}
#endif
#include "spdlog/spdlog.h"
#ifdef __cplusplus
extern "C" {
#endif
void setup_logger()
{
// Setup logger.
}
void log_info(char *msg)
{
spdlog::info(msg);
}
void shutdown_logger()
{
spdlog::shutdown();
}
#ifdef __cplusplus
}
#endif
#include "logging.h"
int main(int argc, char** argv)
{
setup_logger();
log_info("Hello World");
shutdown_logger();
return 0;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Where I can find spdlog API for C?
Beta Was this translation helpful? Give feedback.
All reactions