Skip to content

std::clog vs std::cerr #3

Description

@philip82148

This is an ADR(Architecture Decision Record) rather than an issue I will consider in the future.
But the discussion about this is open.

The reason I chose std::clog is std::cerr flushes std::cout before outputting.

std::clog

std::cout << "This is temporarily buffered to std::cout.";

int my_int = 15;
std::clog << "[dump] " << my_int << std::endl;

std::cout << "NOW STD::COUT FLUSHED" <<std::endl;
[dump] 15
This is temporarily buffered to std::cout.NOW STD::COUT FLUSHED

std::cerr

std::cout << "This is temporarily buffered to std::cout.";

int my_int = 15;
std::cerr << "[dump] " << my_int << std::endl;

std::cout << "NOW STD::COUT FLUSHED" <<std::endl;
This is temporarily buffered to std::cout.[dump] 15
NOW STD::COUT FLUSHED

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions