Skip to content

Commit 1f63b47

Browse files
committed
Cleanup: standardize run_async loop style and remove all emojis from docs
1 parent f90f0e3 commit 1f63b47

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
---
1515

16-
## ⭐️ Getting Started
16+
## Getting Started
1717

1818
```cpp
1919
#include "include/logger.hpp"
@@ -43,7 +43,7 @@ Just add `include/` to your project. No dependencies outside C++17 STL and bundl
4343

4444
## Issues and Contributing
4545
- Please [open an Issue](https://github.com/mbn-code/cLog/issues) for bugs, features, or questions!
46-
- Star the repo if you find it useful
46+
- Star the repo if you find it useful
4747
- [Contributing Guide](CONTRIBUTING.md)
4848

4949
---

include/logger.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,22 +121,27 @@ class Logger {
121121
worker_ = std::thread([this] { run_async(); });
122122
}
123123
void run_async() {
124-
for (;;) {
124+
while (true) {
125125
Entry entry;
126126
{
127127
std::unique_lock<std::mutex> lk(mutex_);
128128
cv_.wait(lk, [&] { return stop_ || !queue_.empty(); });
129129
if (queue_.empty()) {
130-
if (stop_) break;
131-
else continue;
130+
if (stop_) {
131+
break;
132+
} else {
133+
continue;
134+
}
132135
}
133136
entry = std::move(queue_.front());
134137
queue_.pop();
135138
}
136139
emit_entry(entry);
137140
// After emitting, if stop_ and queue is empty, exit
138141
std::unique_lock<std::mutex> lk(mutex_);
139-
if (stop_ && queue_.empty()) break;
142+
if (stop_ && queue_.empty()) {
143+
break;
144+
}
140145
}
141146
}
142147
};

0 commit comments

Comments
 (0)