Skip to content
Snippets Groups Projects
Commit 9fda08b2 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Remove iostream from headers

parent 86b2c9f0
No related branches found
No related tags found
No related merge requests found
......@@ -102,6 +102,7 @@ add_library(matrix_client
lib/crypto/client.cpp
lib/crypto/utils.cpp
lib/utils.cpp
lib/log.cpp
lib/structs/common.cpp
lib/structs/errors.cpp
lib/structs/events.cpp
......
......@@ -2,8 +2,6 @@
#include <nlohmann/json.hpp>
#include <iostream>
#include "mtx/events/messages/image.hpp"
#include "mtx/identifiers.hpp"
......@@ -178,7 +176,7 @@ to_json(json &obj, const Event<Content> &event)
obj["type"] = "m.tag";
break;
case EventType::Unsupported:
std::cout << "Unsupported type to serialize" << std::endl;
default:
break;
}
}
......
#pragma once
#include <exception>
#include <iostream>
#include <nlohmann/json.hpp>
......
#pragma once
#include <string_view>
namespace mtx::utils::log {
void
log_warning(const std::string_view &msg);
void
log_error(const std::string_view &msg);
}
#include <mtx/log.hpp>
#include <iostream>
namespace mtx::utils::log {
void
log_warning(const std::string_view &msg)
{
std::cerr << "warning:" << msg << "\n";
}
void
log_error(const std::string_view &msg)
{
std::cerr << "error:" << msg << "\n";
}
}
#include "mtx/events/collections.hpp"
#include "mtx/log.hpp"
namespace mtx::events::collections {
void
......@@ -84,8 +85,8 @@ from_json(const json &obj, TimelineEvent &e)
e.data = events::RoomEvent<events::msg::Redacted>(obj);
return;
} catch (json::exception &err) {
std::cout << "Invalid event type: " << err.what() << " "
<< obj.dump(2) << '\n';
mtx::utils::log::log_error(std::string("Invalid event type: ") +
err.what() + " " + obj.dump(2));
return;
}
}
......
#include "mtx/responses/sync.hpp"
#include "mtx/events/collections.hpp"
#include "mtx/log.hpp"
#include "mtx/responses/common.hpp"
#include <variant>
......@@ -73,9 +74,9 @@ from_json(const json &obj, Ephemeral &ephemeral)
try {
ts = uit.value().at("ts");
} catch (json::type_error &) {
std::cerr
<< "mtxclient: Workaround synapse bug #4898, "
"ignoring timestamp for m.receipt event\n";
mtx::utils::log::log_warning(
"mtxclient: Workaround synapse bug #4898, "
"ignoring timestamp for m.receipt event");
}
user_times.emplace(uit.key(), ts);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment