summaryrefslogtreecommitdiff
path: root/src/utils.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-04 19:55:27 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-04 19:55:27 -0400
commit2d941730b1c60342be5b108d2d654723b3b7c2cb (patch)
tree6a3f4b7305857e85d2684670492007bafc3668d0 /src/utils.cc
parent73cf3b01fbd50c3a8a4fd96ff69643c28394d8fe (diff)
downloadfork-ledger-2d941730b1c60342be5b108d2d654723b3b7c2cb.tar.gz
fork-ledger-2d941730b1c60342be5b108d2d654723b3b7c2cb.tar.bz2
fork-ledger-2d941730b1c60342be5b108d2d654723b3b7c2cb.zip
Largely removed all of Ledger's use of global variables, for the REPL's sake.
Diffstat (limited to 'src/utils.cc')
-rw-r--r--src/utils.cc22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/utils.cc b/src/utils.cc
index 2cfc69db..74a8ea6c 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -435,12 +435,6 @@ std::ostringstream _log_buffer;
uint8_t _trace_level;
#endif
-#ifdef BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK
-#define CURRENT_TIME() boost::posix_time::microsec_clock::universal_time()
-#else
-#define CURRENT_TIME() boost::posix_time::second_clock::universal_time()
-#endif
-
static inline void stream_memory_size(std::ostream& out, std::size_t size)
{
if (size < 1024)
@@ -458,20 +452,16 @@ static ptime logger_start;
bool logger_func(log_level_t level)
{
- std::size_t appender = 0;
-
if (! logger_has_run) {
logger_has_run = true;
logger_start = CURRENT_TIME();
IF_VERIFY()
- *_log_stream << " TIME OBJSZ MEMSZ" << std::endl;
-
- appender = (logger_start - current_time).total_milliseconds();
+ *_log_stream << " TIME OBJSZ MEMSZ" << std::endl;
}
*_log_stream << std::right << std::setw(5)
- << (CURRENT_TIME() - logger_start).total_milliseconds();
+ << (CURRENT_TIME() - logger_start).total_milliseconds() << "ms";
IF_VERIFY() {
*_log_stream << std::right << std::setw(6) << std::setprecision(3);
@@ -500,13 +490,7 @@ bool logger_func(log_level_t level)
break;
}
- *_log_stream << ' ' << _log_buffer.str();
-
- if (appender)
- *_log_stream << " (" << appender << "ms startup)";
-
- *_log_stream << std::endl;
-
+ *_log_stream << ' ' << _log_buffer.str() << std::endl;
_log_buffer.str("");
return true;