zschoche / mlog Goto Github PK
View Code? Open in Web Editor NEWComfortable lightweight C++ logging library -- cross-platform, C++11.
License: MIT License
Comfortable lightweight C++ logging library -- cross-platform, C++11.
License: MIT License
I used mlog throughout my last project for logging to the mac console, std cout, Window's OutputDebugString and mlog's built-in file logger. I found it to be very nice experience, however one aspect that I was looking for was to be able to log to both file and console / cout / etc. at the same time.
Are there any plans for multiple loggers, or is there a recommended solution with the current design?
Thanks,
Rich
There's a bug at line 76 in mlog/file_logger.hpp. m_stream.open() will only succeed if the stream is already closed. Opening an already open stream will always fail. So I suggest to add m_stream.close(); between line 75 and 76.
I noticed that with the current way that mlogger is managed by a unique_ptr, it can lead to crashes when trying to log in destructors that stem for static data, since that mlogger might already have been destroyed.
I was wondering what your opinions are on having it leak until the application is destroyed. I've made this modification locally and it allows me to log in some really deep parts of my project, but of course it will show up on a leak tool like valgrind. I've always been of the opinion that this is one exception to the rule, anyway. Here's the commit if your interested.
Hey there and thanks for this library, agreed that boost::log is pretty heavy and I'm also looking for a lighter alternative.
I was wondering if you had any plans to support the standard defined preprocessor macros in the mlog::log_metadata
struct, such as __FILE__
, __FUNCTION__
, __LINE__
, etc. I find it much easier to look up in the source code where a problem is with these prepended to my log string, but they need to be captured at the macro level.
For now I'm just going to define my own macros and build the string there, but I think it would be a nice feature (and relatively cheap) to be able to control that behavior from the write_to_log
virtual method.
cheers,
Rich
Hello again,
I've been happily using mlog in our mac builds (thanks!), but I recently switched to try to build on the windows side and have run into a bit of a conundrum due to the lack of support for C++11 variadic templates (only way to enable it is currently with a preview build of vc).
I only see one place where the technique is used, when constructing a mlog::thread_safe<file_logger>. I've hacked my way around it for the moment (makes the thread safe file logger inaccessible), but I was wondering if you would consider a technique that would allow this code to work on the range of microsoft compilers.
cheers,
Rich
It looks like there is a missing reference to Test.vcxproj in mlog.sln, I was hoping to use this to run the tests as you would. Is there any chance it just isn't committed on your end?
Best,
Rich
The project lacks a license, could you please add one? See github's help for options.
Thanks.
cough MIT License is your friend cough
You forgot to mention that this library based on boost and boost is not lightweight! Correct me if I'm wrong!?
thx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.