summaryrefslogtreecommitdiff
path: root/src/debug/RollingLogFollow.hpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-12-07 18:51:18 +0100
committerGitHub <noreply@github.com>2024-12-07 18:51:18 +0100
commit8bbeee11734d3ba8e2cf15d19cb3c302f8bfdbf2 (patch)
tree5b6654818049a0743f62defc090e86d4327cccbb /src/debug/RollingLogFollow.hpp
parentb1e5cc66bdb20b002c93479490c3a317552210b3 (diff)
core: Add clang-tidy (#8664)
This adds a .clang-tidy file for us. It's not a strict requirement to be compliant, but I tuned it to be alright.
Diffstat (limited to 'src/debug/RollingLogFollow.hpp')
-rw-r--r--src/debug/RollingLogFollow.hpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/debug/RollingLogFollow.hpp b/src/debug/RollingLogFollow.hpp
index 5ff018af..0042cd8d 100644
--- a/src/debug/RollingLogFollow.hpp
+++ b/src/debug/RollingLogFollow.hpp
@@ -2,8 +2,9 @@
#include <shared_mutex>
+// NOLINTNEXTLINE(readability-identifier-naming)
namespace Debug {
- struct RollingLogFollow {
+ struct SRollingLogFollow {
std::unordered_map<int, std::string> socketToRollingLogFollowQueue;
std::shared_mutex m;
bool running = false;
@@ -15,12 +16,12 @@ namespace Debug {
return socketToRollingLogFollowQueue[socket].empty();
}
- std::string DebugInfo() {
+ std::string debugInfo() {
std::shared_lock<std::shared_mutex> r(m);
return std::format("RollingLogFollow, got {} connections", socketToRollingLogFollowQueue.size());
}
- std::string GetLog(int socket) {
+ std::string getLog(int socket) {
std::unique_lock<std::shared_mutex> w(m);
const std::string ret = socketToRollingLogFollowQueue[socket];
@@ -29,7 +30,7 @@ namespace Debug {
return ret;
};
- void AddLog(std::string log) {
+ void addLog(const std::string& log) {
std::unique_lock<std::shared_mutex> w(m);
running = true;
std::vector<int> to_erase;
@@ -37,26 +38,26 @@ namespace Debug {
socketToRollingLogFollowQueue[p.first] += log + "\n";
}
- bool IsRunning() {
+ bool isRunning() {
std::shared_lock<std::shared_mutex> r(m);
return running;
}
- void StopFor(int socket) {
+ void stopFor(int socket) {
std::unique_lock<std::shared_mutex> w(m);
socketToRollingLogFollowQueue.erase(socket);
if (socketToRollingLogFollowQueue.empty())
running = false;
}
- void StartFor(int socket) {
+ void startFor(int socket) {
std::unique_lock<std::shared_mutex> w(m);
socketToRollingLogFollowQueue[socket] = std::format("[LOG] Following log to socket: {} started\n", socket);
running = true;
}
- static RollingLogFollow& Get() {
- static RollingLogFollow instance;
+ static SRollingLogFollow& get() {
+ static SRollingLogFollow instance;
static std::mutex gm;
std::lock_guard<std::mutex> lock(gm);
return instance;