SergiusTheBest / plog

Portable, simple and extensible C++ logging library
MIT License
2.19k stars 385 forks source link

always printf null #258

Closed lzytaro closed 1 year ago

lzytaro commented 1 year ago

why always output (null) using printf:

2023-06-27 10:41:04.965 DEBUG [33144] [main@20] (null)
2023-06-27 10:41:04.967 INFO  [33144] [main@19] (null)
2023-06-27 10:41:04.967 DEBUG [33144] [main@20] (null)
2023-06-27 10:41:04.969 INFO  [33144] [main@19] (null)
2023-06-27 10:41:04.969 DEBUG [33144] [main@20] (null)
2023-06-27 10:41:04.971 INFO  [33144] [main@19] (null)
2023-06-27 10:41:04.971 DEBUG [33144] [main@20] (null)
2023-06-27 10:41:04.973 INFO  [33144] [main@19] (null)
2023-06-27 10:41:04.973 DEBUG [33144] [main@20] (null)
2023-06-27 10:41:04.975 INFO  [33144] [main@19] (null)
2023-06-27 10:41:04.975 DEBUG [33144] [main@20] (null)
2023-06-27 10:41:04.977 INFO  [33144] [main@19] (null)
2023-06-27 10:41:04.977 DEBUG [33144] [main@20] (null)
2023-06-27 10:41:04.979 INFO  [33144] [main@19] (null)
2023-06-27 10:41:04.979 DEBUG [33144] [main@20] (null)
2023-06-27 10:41:04.981 INFO  [33144] [main@19] (null)
2023-06-27 10:41:04.981 DEBUG [33144] [main@20] (null)
2023-06-27 10:41:04.983 INFO  [33144] [main@19] (null)
int main() {
    plog::RollingFileAppender<plog::TxtFormatter> fileAppender("log\\log.txt", 1000000, 10);
    plog::ConsoleAppender<plog::TxtFormatter> consoleAppender;

    plog::init(plog::verbose, &fileAppender);
    plog::init(plog::verbose, &consoleAppender);

    while (1) {
        PLOGI.printf("%d %s",1,"ss");
        PLOGD.printf("%d",2);
    }

    return 0;
}
SergiusTheBest commented 1 year ago

What's your compiler and platform?

SergiusTheBest commented 1 year ago

I think it's fixed by https://github.com/SergiusTheBest/plog/issues/261