Giter Site home page Giter Site logo

simple_logger's People

Contributors

fiona-j-w avatar

Watchers

 avatar  avatar

simple_logger's Issues

Log-Support for more than one stream at a time

It would be nice to be able to set more than one active output of the logger at any given time.

logger::set_stream(0, std::out);
logger::note("Only to std::out at this time");
logger::set_stream(1, "/dev/tty1");
logger::note("To std::out and /dev/tty1 for this message");
logger::reset_stream(1);
logger::note("Visible on std::out only again.");
logger::reset_stream(0);
logger::warning("Visible nowhere near you!");

Number of channels should be flexible, low number expected, set_stream on stream already present, closes previous stream on that channel.

Management of streams allocated by user is duty of user; streams opened by the logger interface should be handled there. Providing explicit deleter parameter when setting up a stream called when it is closed is desirable and should use sane default implementation.

More unittests

The current unittests don't jet check filtering the messages. (The previously tested functionality still gets tested though.)

Reduce Copy&Paste in Unit Test

The unit test should be refactored to move the final check of the produced output out into a macro/inline function producing much more concise result check code.

e.g.:

const foo = std::string("string1");
const bar = std::string("string2");

BOOST_CHECK(std::equal(foo.begin(), foo.end(), result.begin()));
BOOST_CHECK(std::equal(bar.rbegin(), bar.rend(), result.rbegin()));

should be simplified to something along the lines of:

LOG_CHECK(result, "string1", "string2");

Log target might reference dead object

The stored reference for the stream used for the output should be aware of when the object/instance it refers to goes out of scope. The current unit test implementation would suffer this dead reference issue if the proper (re-)initialization of the stream was forgotten in even one of the tests.

The current construction is somewhat dangerous ;-)

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.