|
1234567891011121314151617181920212223242526272829303132333435 |
- #include <string>
- #include <thread>
-
- #include "xlog.h"
-
- int main()
- {
- // print log test, you can transfer any param to do format
- int param = 1;
-
- std::thread thd1([¶m](){
- for (int i = 0; i < 100000; i++) {
- _T("this is trace log record, param: {}", ++param); // int type param is ok
- _D("this is debug log record, param: {}", ++param);
- _I("this is info log record, param: {}", ++param);
- _W("this is warn log record, param: {}", double(++param)); // double type param is ok
- _E("this is error log record, param: {}", std::to_string(++param)); // string type param is ok
- }
- });
-
- std::thread thd2([¶m](){
- for (int i = 0; i < 100000; i++) {
- _T("this is trace log record, param: {}", ++param); // int type param is ok
- _D("this is debug log record, param: {}", ++param);
- _I("this is info log record, param: {}", ++param);
- _W("this is warn log record, param: {}", double(++param)); // double type param is ok
- _E("this is error log record, param: {}", std::to_string(++param)); // string type param is ok
- }
- });
-
- thd1.join();
- thd2.join();
-
- return 0;
- }
|