std::clog, std::wclog

Header: <iostream>

The global objects std::clog and std::wclog control output to a stream buffer of implementation-defined type (derived from std::streambuf), associated with the standard C output stream stderr, but, unlike std::cerr/std::wcerr, these streams are not automatically flushed and cout is not automatically tie()’d with these streams.

# Declarations

extern std::ostream clog;
extern std::wostream wclog;

# Notes

The ‘c’ in the name refers to “character” (stroustrup.com FAQ); clog means “character log” and wclog means “wide character log”.

# Example

#include <iostream>
 
struct Foo
{
    int n;
    Foo()
    {
        std::clog << "static constructor\n";
    }
    ~Foo()
    {
        std::clog << "static destructor\n";
    }
};
 
Foo f; // static object
 
int main()
{
    std::clog << "main function\n";
}

# See also