Skip to content

Cross-platform, stateful C++23 logger library based on libfmt, capable of logging to console and/or HTML files.

License

Notifications You must be signed in to change notification settings

Langulus/Logger

Repository files navigation

Langulus::Logger CI

Langulus::Logger

Langulus::Logger is a cross-platform, stateful C++23 logger library based on {fmt} library, capable of logging to console and/or HTML files. It is used in all other Langulus libraries and plug-ins. It contains about a dozen inlined variadic functions with different styles for a consistently pretty and easy logging experience.

This is how it looks in Windows 10 Terminal:

Windows Terminal

This is how it looks when logging to an HTML file (as seen via Chrome web browser):

Chrome Browser

Getting the library

If you have CMake 3.28+, the easiest way to get this library is to use FetchContent in your CMakeLists.txt, like so:

include(FetchContent)
FetchContent_Declare(LangulusLogger
   GIT_REPOSITORY   https://github.com/Langulus/Logger.git
   GIT_TAG          main    # you should use a specific commit/release,
                            # so that you can control when to bump your dependencies
   EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(LangulusLogger)

Then just link to your target to get all the include directories:

target_link_libraries(YourLibrary PUBLIC LangulusLogger)

This will also automagically fetch all dependencies: {fmt} and Langulus::Core.

Using the library

After linking with LangulusLogger, you can include it in your files and call the required functions, which are located in the Langulus::Logger namespace:

#include <Logger/Logger.hpp>
using namespace Langulus;

int main(int argc, char* argv[]) {
   Logger::Info("Hello, world!");
   return 0;
}

Visit the Wiki for a full list of the available functions and customization points.

Considerations

Langulus::Logger's API is unlikely to change drastically - only a couple of additional features remain to be added.

Community feedback

I would love feedback and suggestions, please feel free to join the forum. However it should be stated clearly, that Langulus is primarily a personal project that I've been developing for over 10 years, and is aiming primarily at satisfying my requirements. As such, ideas and suggestions may not be necessarily implemented by me, unless I find them exceedingly useful. If you really need me to add or improve something that isn't on my daily agenda, you should consider sponsoring me.

About

Cross-platform, stateful C++23 logger library based on libfmt, capable of logging to console and/or HTML files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published