X-Git-Url: http://xvm.mit.edu/gitweb/invirt/third/libt4.git/blobdiff_plain/f2170465073de34adf89161d4287182b518352c4:/tprintf.h..2546a41ad36fdc9ef6471cb35a1d56930ae1b527:/threaded_log.h diff --git a/tprintf.h b/threaded_log.h similarity index 88% rename from tprintf.h rename to threaded_log.h index 41539fe..6918220 100644 --- a/tprintf.h +++ b/threaded_log.h @@ -1,5 +1,5 @@ -#ifndef tprintf_h -#define tprintf_h +#ifndef threaded_log_h +#define threaded_log_h #include #include @@ -12,7 +12,7 @@ extern std::map thread_name_map; extern int next_thread_num; extern std::map instance_name_map; extern int next_instance_num; -extern char tprintf_thread_prefix; +extern char log_thread_prefix; template struct iterator_pair : public std::pair { @@ -51,7 +51,7 @@ std::ostream & operator<<(std::ostream &o, const iterator_pair &d) { _tid_ = thread_name_map[_thread_] = ++next_thread_num; \ auto _utime_ = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count() % 1000000000; \ std::cerr << std::setfill('0') << std::dec << std::left << std::setw(9) << _utime_ << " "; \ - std::cerr << tprintf_thread_prefix << std::left << std::setw(2) << _tid_; \ + std::cerr << std::setfill(' ') << log_thread_prefix << std::left << std::setw(2) << _tid_; \ std::cerr << " " << std::setw(20) << __FILE__ << " " << std::setw(18) << __func__; \ } #define LOG_THIS_POINTER { \ @@ -98,13 +98,4 @@ std::ostream & operator<<(std::ostream &o, const iterator_pair &d) { LOG_SUFFIX; \ } -#define tprintf(...) { \ - char *buf = nullptr; \ - int len = asprintf(&buf, __VA_ARGS__); \ - if (buf[len-1]=='\n') \ - buf[len-1] = '\0'; \ - LOG_NONMEMBER(buf); \ - free(buf); \ -} - #endif