0

I would like to make a console logger in my ImGui implementation , I got inspired by the one in the demo and made the background invisible, it's a bit ghetto but very practical. I have created it as a static namespace, but this means that I cannot print from different threads because the buffer isn’t the same... I would like to do it using a singleton, but it is apparently not recommended, what would be the most suitable way to code it? Thanks

Bam Bou
  • 95
  • 1
  • 7
  • You may just want to use a c++ logging library. There are a list of some the most popular ones in this link: [https://en.cppreference.com/w/cpp/links/libs](https://en.cppreference.com/w/cpp/links/libs) – drescherjm Jul 27 '22 at 17:28
  • Thanks interesting! Can I link this to imgui to print onscreen? I just need some simples print – Bam Bou Jul 27 '22 at 17:59
  • Many of these loggers will have the ability to log to the console (in addition to files and other output options) and support multiple threads sending at the same time. Many will have a source / sink concept where you can have multiple source and multiple sinks. – drescherjm Jul 27 '22 at 19:59
  • Thank you for your interest after taking a look it's seem a bit complicated for what i'm trying to do, I made a more accurate post – Bam Bou Jul 27 '22 at 20:20
  • I think these are a lot simpler than what you are trying to do. Some of them are just a single header and in less than 10 lines of code added you would be done. – drescherjm Jul 27 '22 at 20:26
  • Do you have one exactly in mind? I only found huge logger, I just need to have a kind of big static buffer wich is printed every cycle in my imgui windows and able to be called everywhere – Bam Bou Jul 27 '22 at 20:33
  • https://github.com/gabime/spdlog you can compile it to a library or use it as a header only. – drescherjm Jul 28 '22 at 00:14
  • This one is a single file header only: [https://github.com/amrayn/easyloggingpp](https://github.com/amrayn/easyloggingpp) – drescherjm Jul 28 '22 at 00:18
  • Once again thank. I’ll give it a try even if I don’t really know how to output this in my imgui window – Bam Bou Jul 28 '22 at 10:16
  • @BamBou bit late to the party, but have you found any solution to print logs using imgui? – Harsh patel Aug 03 '23 at 05:48

0 Answers0