added possibility to open files and close them automatically

This commit is contained in:
Lionel Parreaux 2013-05-06 17:33:36 +02:00
commit 002e4a1964
3 changed files with 52 additions and 64 deletions

View file

@ -31,21 +31,24 @@ int main(int ac, char** av)
//eo::log << eo::file("test.txt") << "In FILE" << std::endl;
std::ofstream ofs("test.txt");
std::ofstream ofs("logtest.txt");
//eo::log << ofs << "In FILE" << std::endl;
eo::log.redirectTo(ofs);
eo::log.redirect(ofs);
eo::log << "In FILE" << std::endl;
eo::log.redirect("logtest2.txt");
eo::log << "In FILE 2" << std::endl;
std::ostringstream oss;
//eo::log << oss << "In STRINGSTREAM";
eo::log.redirectTo(oss);
eo::log.redirect(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.redirect(std::cout);
eo::log << "on COUT" << std::endl;
eo::log << eo::setlevel("errors");