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