Remove more printf logging.

GitOrigin-RevId: f5573d9676426e21fde45bf4dace19ae53943e3c
This commit is contained in:
levlam 2018-02-11 17:52:41 +03:00
parent 6e3cbf42dc
commit a7e9fb5e62
6 changed files with 18 additions and 15 deletions

View File

@ -32,7 +32,7 @@ class RingBench : public td::Benchmark {
std::string get_description() const override { std::string get_description() const override {
static const char *types[] = {"later", "immediate", "raw", "tail", "lambda"}; static const char *types[] = {"later", "immediate", "raw", "tail", "lambda"};
static_assert(0 <= type && type < 5, ""); static_assert(0 <= type && type < 5, "");
return PSTRING("Ring (send_%s) (threads_n = %d)", types[type], thread_n_); return PSTRING() << "Ring (send_" << types[type] << ") (threads_n = " << thread_n_ << ")";
} }
struct PassActor : public td::Actor { struct PassActor : public td::Actor {

View File

@ -30,7 +30,7 @@ class SHA1Bench : public td::Benchmark {
alignas(64) unsigned char data[DATA_SIZE]; alignas(64) unsigned char data[DATA_SIZE];
std::string get_description() const override { std::string get_description() const override {
return PSTRING("SHA1 OpenSSL [%dKB]", DATA_SIZE >> 10); return PSTRING() << "SHA1 OpenSSL [" << (DATA_SIZE >> 10) << "KB]";
} }
void start_up() override { void start_up() override {
@ -55,7 +55,7 @@ class AESBench : public td::Benchmark {
td::UInt256 iv; td::UInt256 iv;
std::string get_description() const override { std::string get_description() const override {
return PSTRING("AES OpenSSL [%dKB]", DATA_SIZE >> 10); return PSTRING() << "AES OpenSSL [" << (DATA_SIZE >> 10) << "KB]";
} }
void start_up() override { void start_up() override {
@ -152,7 +152,7 @@ class Crc32Bench : public td::Benchmark {
alignas(64) unsigned char data[DATA_SIZE]; alignas(64) unsigned char data[DATA_SIZE];
std::string get_description() const override { std::string get_description() const override {
return PSTRING("Crc32 zlib [%dKB]", DATA_SIZE >> 10); return PSTRING() << "Crc32 zlib [" << (DATA_SIZE >> 10) << "KB]";
} }
void start_up() override { void start_up() override {
@ -176,7 +176,7 @@ class Crc64Bench : public td::Benchmark {
alignas(64) unsigned char data[DATA_SIZE]; alignas(64) unsigned char data[DATA_SIZE];
std::string get_description() const override { std::string get_description() const override {
return PSTRING("Crc64 Anton [%dKB]", DATA_SIZE >> 10); return PSTRING() << "Crc64 Anton [" << (DATA_SIZE >> 10) << "KB]";
} }
void start_up() override { void start_up() override {

View File

@ -149,7 +149,7 @@ Result<SslFd> SslFd::init(SocketFd fd, CSlice host, CSlice cert_file, VerifyPeer
// TODO(now): cipher list // TODO(now): cipher list
string cipher_list; string cipher_list;
if (SSL_CTX_set_cipher_list(ssl_ctx, cipher_list.empty() ? "DEFAULT" : cipher_list.c_str()) == 0) { if (SSL_CTX_set_cipher_list(ssl_ctx, cipher_list.empty() ? "DEFAULT" : cipher_list.c_str()) == 0) {
return create_openssl_error(-9, PSLICE("Failed to set cipher list \"%s\"", cipher_list.c_str())); return create_openssl_error(-9, PSLICE() << "Failed to set cipher list \"" << cipher_list << '"');
} }
auto ssl_handle = SSL_new(ssl_ctx); auto ssl_handle = SSL_new(ssl_ctx);

View File

@ -129,14 +129,16 @@ class DelayedClosure {
explicit DelayedClosure( explicit DelayedClosure(
const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &other, const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &other,
std::enable_if_t<!LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value, int> = 0) { std::enable_if_t<!LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value, int> = 0) {
UNREACHABLE("deleted constructor"); LOG(FATAL) << "Deleted constructor";
std::abort();
} }
template <class FromActorT, class FromFunctionT, class... FromArgsT> template <class FromActorT, class FromFunctionT, class... FromArgsT>
std::enable_if_t<!LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value, std::enable_if_t<!LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value,
DelayedClosure<FromActorT, FromFunctionT, FromArgsT...>> DelayedClosure<FromActorT, FromFunctionT, FromArgsT...>>
do_clone(const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &value) const { do_clone(const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &value) const {
UNREACHABLE("Trying to clone DelayedClosure that contains noncopyable elements"); LOG(FATAL) << "Trying to clone DelayedClosure that contains noncopyable elements";
std::abort();
} }
template <class FromActorT, class FromFunctionT, class... FromArgsT> template <class FromActorT, class FromFunctionT, class... FromArgsT>

View File

@ -286,7 +286,7 @@ Result<size_t> Fd::write_unsafe(Slice slice) {
if (write_res >= 0) { if (write_res >= 0) {
return narrow_cast<size_t>(write_res); return narrow_cast<size_t>(write_res);
} }
return Status::PosixError(write_errno, PSLICE("Write to [fd=%d] has failed", native_fd)); return Status::PosixError(write_errno, PSLICE() << "Write to fd " << native_fd << " has failed");
} }
Result<size_t> Fd::write(Slice slice) { Result<size_t> Fd::write(Slice slice) {
@ -306,7 +306,7 @@ Result<size_t> Fd::write(Slice slice) {
return 0; return 0;
} }
auto error = Status::PosixError(write_errno, PSLICE("Write to [fd=%d] has failed", native_fd)); auto error = Status::PosixError(write_errno, PSLICE() << "Write to fd " << native_fd << " has failed");
switch (write_errno) { switch (write_errno) {
case EBADF: case EBADF:
case ENXIO: case ENXIO:
@ -352,7 +352,7 @@ Result<size_t> Fd::read(MutableSlice slice) {
clear_flags(Read); clear_flags(Read);
return 0; return 0;
} }
auto error = Status::PosixError(read_errno, PSLICE("Read from [fd=%d] has failed", native_fd)); auto error = Status::PosixError(read_errno, PSLICE() << "Read from fd " << native_fd << " has failed");
switch (read_errno) { switch (read_errno) {
case EISDIR: case EISDIR:
case EBADF: case EBADF:

View File

@ -44,7 +44,8 @@ size_t IPAddress::get_sockaddr_len() const {
case AF_INET: case AF_INET:
return sizeof(ipv4_addr_); return sizeof(ipv4_addr_);
default: default:
UNREACHABLE("Unknown address family"); LOG(FATAL) << "Unknown address family";
return 0;
} }
} }
@ -79,7 +80,7 @@ IPAddress IPAddress::get_any_addr() const {
res.init_ipv4_any(); res.init_ipv4_any();
break; break;
default: default:
UNREACHABLE("Unknown address family"); LOG(FATAL) << "Unknown address family";
} }
return res; return res;
} }
@ -317,7 +318,7 @@ bool operator==(const IPAddress &a, const IPAddress &b) {
std::memcmp(&a.ipv6_addr_.sin6_addr, &b.ipv6_addr_.sin6_addr, sizeof(a.ipv6_addr_.sin6_addr)) == 0; std::memcmp(&a.ipv6_addr_.sin6_addr, &b.ipv6_addr_.sin6_addr, sizeof(a.ipv6_addr_.sin6_addr)) == 0;
} }
UNREACHABLE("Unknown address family"); LOG(FATAL) << "Unknown address family";
return false; return false;
} }
@ -341,7 +342,7 @@ bool operator<(const IPAddress &a, const IPAddress &b) {
return std::memcmp(&a.ipv6_addr_.sin6_addr, &b.ipv6_addr_.sin6_addr, sizeof(a.ipv6_addr_.sin6_addr)) < 0; return std::memcmp(&a.ipv6_addr_.sin6_addr, &b.ipv6_addr_.sin6_addr, sizeof(a.ipv6_addr_.sin6_addr)) < 0;
} }
UNREACHABLE("Unknown address family"); LOG(FATAL) << "Unknown address family";
return false; return false;
} }