
大家好,又见面了,我是你们的朋友全栈君。



#include <iostream>
#include <cstdio>
#include "spdlog/spdlog.h"
#include "spdlog/sinks/rotating_file_sink.h"
using namespace std;
using namespace spdlog;
auto rotating_logger = rotating_logger_mt("mylog", "logs/rotating.txt", 1048576 * 5, 3);
int main(int, char *[])
{
int a, b;
a = 5;
b = 3;
float c = 0.1245;
string s = "hello";
cout << "a=" << a << " b=" << b << endl;
rotating_logger->error("error!!!");
rotating_logger->info("a = {},b={},a/b={},a%b={}", a, b, a/b,a%b);
rotating_logger->info("c = {},s = {} ", c, s);
rotating_logger->flush();
system("pause");
return 1;
}

rotating_logger->flush();参考: https://github.com/gabime/spdlog https://www.cnblogs.com/oucsheep/p/8426548.html https://blog.csdn.net/yanxiaobugyunsan/article/details/79088533
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/152301.html原文链接:https://javaforall.cn