Skip to content

r-lyeh-archived/DrEcho

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DrEcho 💊

  • Dr Echo to spice your terminal up. Written in C++11.
  • Dr Echo is cross-platform.
  • Dr Echo is zlib/libpng licensed.

API

#include <iostream>
#include "drecho.hpp"

// default settings
const bool dr::log_timestamp = true;
const bool dr::log_branch = true;
const bool dr::log_branch_scope = true;
const bool dr::log_text = true;
const bool dr::log_errno = true;
const bool dr::log_location = true;

int main(void) {
    // hello world, classic
    std::cout << "classic hello world" << std::endl;

    // DrEcho spices up this
    dr::echo << "new hello world. notice the extra timestamp on the left" << std::endl;

    // DrEcho can also detect posix, OpenGL and win32 errors automatically
    errno = EAGAIN;
    dr::echo << "an error will be catched on this line" << std::endl;

    // Set up a few custom keywords to highlight
    dr::highlight( DR_YELLOW, { "warn", "warning" } );
    dr::highlight( DR_GREEN, { "info", "debug" } );
    dr::highlight( DR_CYAN, { "another", "branch" } );
    dr::echo << "this is another warning with a few debug keywords" << std::endl;

    // Spice up cout from now
    dr::capture( std::cout );
    std::cout << "this cout will be highlighted" << std::endl;

    // Showcase tree usage
    {
        dr::tab scope;
        std::cout << "this is branch #1" << std::endl;
        {
            dr::tab scope;
            std::cout << "this is branch #1.1" << std::endl;
            std::cout << "this is branch #1.2" << std::endl;
            {
                dr::tab scope;
                std::cout << "this is branch #1.2.1" << std::endl;
                std::cout << "this is branch #1.2.2" << std::endl;
            }
            std::cout << "this is branch #1.3" << std::endl;
        }
        std::cout << "this is branch #2" << std::endl;
    }

    // Release our spiced up cout
    dr::release( std::cout );
    std::cout << ">> back to ordinary world" << std::endl;
}

Possible output

image

Changelog

  • v1.0.0 (2016/04/11): Initial semantic versioning adherence

About

💊 Dr Echo spices your terminal up (C++11)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages