Coder Social home page Coder Social logo

mualphaomegaepsilon / minlog Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 159 KB

A Minimalist Logger for C++.

License: MIT License

C++ 25.06% CMake 60.82% Shell 14.13%
cpp logging logger logging-library minimal minimalistic minimalist library easy-to-use small

minlog's Introduction

MinLog

Minimalist Logger for C++

This is a README file for MinLog, a minimalist C++ logger header.
The README is organized as a FAQ.

What's the point of having another logging library for C++?

I wanted a very small set of logging tools, without the usual bloat that a logging library usually adds, since I'm not going to use most of those features and I have no intention to wrap my head around verbosity levels, logger initializations, and so on.
I JUST WANT TO LOG

What are the pros of this library?

  • Header-only library
  • No initialization required
  • No structs nor classes involved
  • Printf-like
  • Under 100 LOC (Lines Of Code) in C++ --> Under 150 LOC in Assembly with the -01 flag
  • Logging can be entirely disabled without additional runtime-cost by defining a macro
  • Always adds a newline after your string for you
  • Doxygen ready
  • CMake ready

What are the functions offered by this library?

  • LOG (" ", ...): Logs to the standard output like a normal printf.
  • LOG_DEBUG (" ", ...): Logs to the standard output only if the NDEBUG flag is not defined by a macro. Useful for logging in debug, but not during release.
  • LOG_ERROR (" ", ...): Logs to the standard error.
  • LOG_EXIT (" ", ...): Logs to the standard error, than makes the program exit with the EXIT_FAILURE code. Remember that if you want to call a "cleanup funcion" before exiting, you can do this by using the "atexit" function.

How can I integrate this library using CMake?

After cloning this repo like this:

git clone https://github.com/MuAlphaOmegaEpsilon/MinLog

Just add these two lines inside your CMakeLists.txt file:

ADD_SUBDIRECTORY (***path_to_MinLog_folder***)
TARGET_LINK_LIBRARIES (***project_name*** PUBLIC MinLog)

And then include this library wherever you want in your project with:

#include <MinLog/MinLog.hpp>

Are there any examples?

Yes, you can find a simple usage case inside the tests/ folder.

How can I launch it?

There you go. Remember that this test executable is programmed to log an error when the local time has odd seconds.

mkdir build
cd build
cmake .. -DBUILD_TESTING=ON
make
./MinLogTest

What is the license used by MinLog?

The GNU General Public License v3.0.
Open the LICENSE file for more informations about it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.