adapted eoLogger for redirecting to ostreams
This commit is contained in:
parent
ea62b371e5
commit
146aff8a3b
3 changed files with 73 additions and 30 deletions
|
|
@ -3,6 +3,10 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <eo>
|
||||
//#include <paradiseo/eo.h>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -25,8 +29,24 @@ int main(int ac, char** av)
|
|||
|
||||
eo::log << "We are writing on the default output stream" << std::endl;
|
||||
|
||||
eo::log << eo::file("test.txt") << "In FILE" << std::endl;
|
||||
eo::log << std::cout << "on COUT" << std::endl;
|
||||
//eo::log << eo::file("test.txt") << "In FILE" << std::endl;
|
||||
|
||||
std::ofstream ofs("test.txt");
|
||||
//eo::log << ofs << "In FILE" << std::endl;
|
||||
eo::log.redirectTo(ofs);
|
||||
eo::log << "In FILE" << std::endl;
|
||||
|
||||
std::ostringstream oss;
|
||||
//eo::log << oss << "In STRINGSTREAM";
|
||||
eo::log.redirectTo(oss);
|
||||
eo::log << oss << "In STRINGSTREAM";
|
||||
|
||||
//ofs << oss;
|
||||
std::cout << "Content of ostringstream: " << oss.str() << std::endl;
|
||||
|
||||
//eo::log << std::cout << "on COUT" << std::endl;
|
||||
eo::log.redirectTo(std::cout);
|
||||
eo::log << "on COUT" << std::endl;
|
||||
|
||||
eo::log << eo::setlevel("errors");
|
||||
eo::log << eo::setlevel(eo::errors);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue