summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-05-31 15:00:38 +0100
committerLinus Groh <mail@linusgroh.de>2021-05-31 17:43:54 +0100
commit303358220b3bf8a6790e6c4350f1e97387f113cf (patch)
treefc09433abb3cf78e22e382ec3a454d7eec3247a7 /Userland
parent1b81b636637781f7519ab2ad6c107a9e398e830b (diff)
downloadserenity-303358220b3bf8a6790e6c4350f1e97387f113cf.zip
LibCore: Replace fprintf(stderr)/printf() with warnln()/out()
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibCore/Object.cpp8
-rw-r--r--Userland/Libraries/LibCore/ProcessStatisticsReader.cpp5
-rw-r--r--Userland/Libraries/LibCore/Socket.cpp4
3 files changed, 8 insertions, 9 deletions
diff --git a/Userland/Libraries/LibCore/Object.cpp b/Userland/Libraries/LibCore/Object.cpp
index be147d73e0..706bf3c95f 100644
--- a/Userland/Libraries/LibCore/Object.cpp
+++ b/Userland/Libraries/LibCore/Object.cpp
@@ -149,12 +149,12 @@ void Object::stop_timer()
void Object::dump_tree(int indent)
{
for (int i = 0; i < indent; ++i) {
- printf(" ");
+ out(" ");
}
- printf("%s{%p}", class_name(), this);
+ out("{}{{{:p}}}", class_name(), this);
if (!name().is_null())
- printf(" %s", name().characters());
- printf("\n");
+ out(" {}", name());
+ outln();
for_each_child([&](auto& child) {
child.dump_tree(indent + 2);
diff --git a/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp b/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp
index 1abdf6b510..4c486f293c 100644
--- a/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp
+++ b/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp
@@ -11,7 +11,6 @@
#include <LibCore/File.h>
#include <LibCore/ProcessStatisticsReader.h>
#include <pwd.h>
-#include <stdio.h>
namespace Core {
@@ -21,13 +20,13 @@ Optional<Vector<Core::ProcessStatistics>> ProcessStatisticsReader::get_all(RefPt
{
if (proc_all_file) {
if (!proc_all_file->seek(0, Core::SeekMode::SetPosition)) {
- fprintf(stderr, "ProcessStatisticsReader: Failed to refresh /proc/all: %s\n", proc_all_file->error_string());
+ warnln("ProcessStatisticsReader: Failed to refresh /proc/all: {}", proc_all_file->error_string());
return {};
}
} else {
proc_all_file = Core::File::construct("/proc/all");
if (!proc_all_file->open(Core::OpenMode::ReadOnly)) {
- fprintf(stderr, "ProcessStatisticsReader: Failed to open /proc/all: %s\n", proc_all_file->error_string());
+ warnln("ProcessStatisticsReader: Failed to open /proc/all: {}", proc_all_file->error_string());
return {};
}
}
diff --git a/Userland/Libraries/LibCore/Socket.cpp b/Userland/Libraries/LibCore/Socket.cpp
index cc8cb9c099..a21445e84c 100644
--- a/Userland/Libraries/LibCore/Socket.cpp
+++ b/Userland/Libraries/LibCore/Socket.cpp
@@ -106,7 +106,7 @@ bool Socket::connect(const SocketAddress& address)
auto dest_address = address.to_string();
bool fits = dest_address.copy_characters_to_buffer(saddr.sun_path, sizeof(saddr.sun_path));
if (!fits) {
- fprintf(stderr, "Core::Socket: Failed to connect() to %s: Path is too long!\n", dest_address.characters());
+ warnln("Core::Socket: Failed to connect() to {}: Path is too long!", dest_address);
errno = EINVAL;
return false;
}
@@ -139,7 +139,7 @@ bool Socket::common_connect(const struct sockaddr* addr, socklen_t addrlen)
return true;
}
int saved_errno = errno;
- fprintf(stderr, "Core::Socket: Failed to connect() to %s: %s\n", destination_address().to_string().characters(), strerror(saved_errno));
+ warnln("Core::Socket: Failed to connect() to {}: {}", destination_address().to_string(), strerror(saved_errno));
errno = saved_errno;
return false;
}