Remove calls to Logger.printf.

GitOrigin-RevId: 3b5452fc4bd705ce5cf98d360247ec0146923e2d
This commit is contained in:
levlam 2018-02-11 17:07:16 +03:00
parent 834fa51b45
commit 6e3cbf42dc
8 changed files with 20 additions and 13 deletions

View File

@ -75,7 +75,7 @@ class FILEWriteBench : public td::Benchmark {
public:
std::string get_description() const override {
return "fprintf (to file, no buf, no flush)";
return "std::fprintf (to file, no buf, no flush)";
}
void start_up() override {

View File

@ -201,7 +201,7 @@ void SequenceDispatcher::timeout_expired() {
}
CHECK(!parent_.empty());
set_timeout_in(1);
VLOG(DEBUG) << "SequenceDispatcher ready to close";
LOG(DEBUG) << "SequenceDispatcher ready to close";
send_closure(parent_, &Parent::ready_to_close);
}

View File

@ -3928,7 +3928,7 @@ void Td::hangup_shared() {
} else if (type == ActorIdType) {
dec_actor_refcnt();
} else {
LOG(FATAL, "Unknown hangup_shared ") << tag("type", type);
LOG(FATAL) << "Unknown hangup_shared of type " << type;
}
}

View File

@ -147,7 +147,8 @@ inline StringBuilder &operator<<(StringBuilder &builder, const Escaped &escaped)
if (c > 31 && c < 127 && c != '"' && c != '\\') {
builder << static_cast<char>(c);
} else {
builder.printf("\\%03o", c);
const char *oct = "01234567";
builder << "\\0" << oct[c >> 6] << oct[(c >> 3) & 7] << oct[c & 7];
}
}
return builder;

View File

@ -56,12 +56,18 @@ Logger::Logger(LogInterface &log, int log_level, Slice file_name, int line_num,
}
file_name = file_name.substr(last_slash_ + 1);
printf("[%2d]", log_level);
auto tid = get_thread_id();
if (tid != -1) {
printf("[t%2d]", tid);
auto thread_id = get_thread_id();
(*this) << '[';
if (log_level < 10) {
(*this) << ' ';
}
(*this) << StringBuilder::FixedDouble(Clocks::system(), 9) << "[" << file_name << ":" << line_num << "]";
(*this) << log_level << '][t';
if (thread_id < 10) {
(*this) << ' ';
}
(*this) << thread_id << ']' << StringBuilder::FixedDouble(Clocks::system(), 9) << "[" << file_name << ":" << line_num
<< "]";
if (tag_ != nullptr && *tag_) {
(*this) << "[#" << Slice(tag_) << "]";
}

View File

@ -12,14 +12,14 @@
* Predefined log levels: FATAL, ERROR, WARNING, INFO, DEBUG
*
* LOG(WARNING) << "Hello world!";
* LOG(INFO, "Hello %d", 1234) << " world!";
* LOG(INFO) << "Hello " << 1234 << " world!";
* LOG_IF(INFO, condition) << "Hello world if condition!";
*
* Custom log levels may be defined and used using VLOG:
* int VERBOSITY_NAME(custom) = VERBOSITY_NAME(WARNING);
* VLOG(custom) << "Hello custom world!"
*
* LOG(FATAL, "power is off");
* LOG(FATAL) << "Power is off";
* CHECK(condition) <===> LOG_IF(FATAL, !(condition))
*/

View File

@ -64,7 +64,7 @@ Stat fstat(int native_fd) {
struct ::stat buf;
int err = fstat(native_fd, &buf);
auto fstat_errno = errno;
LOG_IF(FATAL, err < 0) << Status::PosixError(fstat_errno, PSLICE() << "stat of fd " << native_fd << " failed");
LOG_IF(FATAL, err < 0) << Status::PosixError(fstat_errno, PSLICE() << "stat for fd " << native_fd << " failed");
return detail::from_native_stat(buf);
}

View File

@ -147,7 +147,7 @@ void KQueue::run(int timeout_ms) {
flags |= Fd::Close;
}
if (event->fflags & EV_ERROR) {
LOG(FATAL, "EV_ERROR in kqueue is not supported");
LOG(FATAL) << "EV_ERROR in kqueue is not supported";
}
VLOG(fd) << "Event [fd:" << event->ident << "] [filter:" << event->filter << "] [udata: " << event->udata << "]";
// LOG(WARNING) << "event->ident = " << event->ident << "event->filter = " << event->filter;