(re-) added log to std::clog; refs #169

master
Marc Wäckerlin 12 years ago
parent 25d01618f6
commit 7d10b872c9
  1. 12
      src/qbrowserlib/log.cxx
  2. 9
      src/qbrowserlib/log.hxx

@ -21,9 +21,8 @@ namespace qbrowserlib {
if (!_debug || !_close) return;
++_level;
std::stringstream ss;
// init(ss);
indent(ss)<<"\\ "<<_name;
// std::clog<<close(ss).str()<<std::endl;
close(init(std::clog)<<ss.str())<<std::endl;
if (!_dialog) _dialog = new LogDialog;
_dialog->append(*this, ss.str());
}
@ -31,9 +30,8 @@ namespace qbrowserlib {
Log::~Log() throw() {
if (!_debug || !_close) return;
std::stringstream ss;
// init(ss);
indent(ss)<<"/ "<<_name;
// std::clog<<close(ss).str()<<std::endl;
close(init(std::clog)<<ss.str())<<std::endl;
--_level;
if (!_dialog) _dialog = new LogDialog;
_dialog->append(*this, ss.str());
@ -47,7 +45,7 @@ namespace qbrowserlib {
_dialog->show();
}
std::stringstream& Log::init(std::stringstream& ss) {
std::ostream& Log::init(std::ostream& ss) {
if (_addr)
ss<<std::hex<<std::setw(15)<<_addr<<": "<<std::dec;
else
@ -55,12 +53,12 @@ namespace qbrowserlib {
return ss;
}
std::stringstream& Log::indent(std::stringstream& ss) {
std::ostream& Log::indent(std::ostream& ss) {
ss<<std::setw(2+_level)<<std::setfill(' ');
return ss;
}
std::stringstream& Log::close(std::stringstream& ss) {
std::ostream& Log::close(std::ostream& ss) {
ss<<" ("<<_file<<':'<<_line<<')';
return ss;
}

@ -89,11 +89,11 @@ namespace qbrowserlib {
private:
std::stringstream& init(std::stringstream& ss);
std::ostream& init(std::ostream& ss);
std::stringstream& indent(std::stringstream& ss);
std::ostream& indent(std::ostream& ss);
std::stringstream& close(std::stringstream& ss);
std::ostream& close(std::ostream& ss);
private:
@ -217,9 +217,8 @@ namespace qbrowserlib {
template<typename TYPE> Log& Log::operator<<(TYPE arg) {
if (!_debug) return *this;
std::stringstream ss;
// init(ss);
indent(ss)<<""<<arg;
// std::clog<<close(ss).str()<<std::endl;
close(init(std::clog)<<ss.str())<<std::endl;
if (!_dialog) _dialog = new LogDialog;
_dialog->append(*this, ss.str());
return *this;

Loading…
Cancel
Save