Coder Social home page Coder Social logo

dlg's Introduction

dlg

Just another lightweight logging library with C and C++ api. Pretty much everything can be configured (kinda like bring your own outputting and formatting and filtering system and handle all the additional fancy stuff yourself, but only if you want to, otherwise we got some pretty nice defaults for you).

I tried hard to keep the amount of unneeded bullshit to a minimum (adding loc amount to convince you here, pretty hard to write much bullshit besides a well-documented logging interface in a few hundred lines):

There are 3 headers:

  • <dlg/dlg.h> (around 280 loc): Everything you need, no dependencies
  • <dlg/output.h> (around 150 loc): Utilities for implementing custom output handlers
  • <dlg/dlg.hpp> (around 330 loc): Modern C++11 utilities, typesafe formatter

You can either build dlg.c as library or include it directly into your project (nothing else needed). The name stands for some kind of super clever word mixture of the words 'debug' and 'log' (think of something yourself, duh). Uses meson as build system, but you don't really need a build system for this after all.

Show me something fancy already

Besides a simple look into the headers, have a look into the synopsis and additional documentation for the latest release.

Thousands words, explanations and pictures don't say as much as a single code example though. Here a simple preview of its core functionality (there is more fancy stuff, look into the linked example):

dlg_warn("This is a warning. If on a console, it will be printed yellow");
dlg_error("Errors are red. Colors work even on windows consoles");
dlg_assertm(1 == 2, "Well, this assertion will probably %s...", "fail");
dlg_infot(("tag1", "tag2"), "We can tag our stuff. Can be used to filter/redirect messages");
dlg_asserttm(("tag3"), 3 == 2, "The same goes for asserts");
dlg_info("Another feature: Utf-8 printing works automatically, even for שׁǐʼnďốẅś consoles");
dlg_fatal("This one is printed bold. For more information, read the linked example above already");

Nontheless a rather beautiful picture of dlg in action for you. It is probably rather nonsensical without having read the example though:

Here should a beautiful picture of dlg in action be erected. What a shame!

Note though that dlg can be used without weird dummy messages as well. Building the sample can be enabled by passing the 'sample' argument as true to meson (meson -Dsample=true).

Contributions of all kind are welcome, this is nothing too serious though

dlg's People

Contributors

nyorain avatar lemzwerg avatar priyeshkkumar avatar

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.