extra comments
This commit is contained in:
parent
d17bba34bc
commit
6e9b6a18fb
2 changed files with 7 additions and 7 deletions
|
@ -96,7 +96,7 @@
|
||||||
// the value here (8u, 16u, 32u, etc) is what governs max threads at 5126
|
// the value here (8u, 16u, 32u, etc) is what governs max threads at 5126
|
||||||
#ifndef CPPHTTPLIB_THREAD_POOL_COUNT
|
#ifndef CPPHTTPLIB_THREAD_POOL_COUNT
|
||||||
#define CPPHTTPLIB_THREAD_POOL_COUNT \
|
#define CPPHTTPLIB_THREAD_POOL_COUNT \
|
||||||
((std::max)(128u, std::thread::hardware_concurrency() > 0 \
|
((std::max)(128u, std::thread::hardware_concurrency() > 0 \
|
||||||
? std::thread::hardware_concurrency() - 1 \
|
? std::thread::hardware_concurrency() - 1 \
|
||||||
: 0))
|
: 0))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -144,7 +144,7 @@ static inline void server_log(const char *level, const char *function, int line,
|
||||||
};
|
};
|
||||||
|
|
||||||
// freopen("/dev/null", "w", stdout);
|
// freopen("/dev/null", "w", stdout);
|
||||||
freopen("/dev/null", "w", stderr);
|
freopen("/dev/null", "w", stderr); // we assign stderr to dev/null effectively 'blackholing' the output because log.dump below is redirected too
|
||||||
|
|
||||||
if (server_log_json) {
|
if (server_log_json) {
|
||||||
log.merge_patch(
|
log.merge_patch(
|
||||||
|
@ -157,9 +157,9 @@ static inline void server_log(const char *level, const char *function, int line,
|
||||||
if (!extra.empty()) {
|
if (!extra.empty()) {
|
||||||
log.merge_patch(extra);
|
log.merge_patch(extra);
|
||||||
}
|
}
|
||||||
|
std::cerr << log.dump(-1, ' ', false, json::error_handler_t::replace) << "\n" << std::flush; // was originally std:cout
|
||||||
|
|
||||||
std::cerr << log.dump(-1, ' ', false, json::error_handler_t::replace) << "\n" << std::flush;
|
} else { // store the logs in (because not json) text format
|
||||||
} else {
|
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
snprintf(buf, 1024, "\033[85;0H%4s [%24s] %s", level, function, message);
|
snprintf(buf, 1024, "\033[85;0H%4s [%24s] %s", level, function, message);
|
||||||
|
|
||||||
|
@ -177,10 +177,10 @@ static inline void server_log(const char *level, const char *function, int line,
|
||||||
|
|
||||||
const std::string str = ss.str();
|
const std::string str = ss.str();
|
||||||
printf("\033[85;0H%.*s\n", (int)str.size(), str.data());
|
printf("\033[85;0H%.*s\n", (int)str.size(), str.data());
|
||||||
fflush(stderr);
|
fflush(stderr); // was originally fflush(stdout)
|
||||||
|
|
||||||
// freopen("/dev/tty", "a", stdout);
|
// freopen("/dev/tty", "a", stdout); // decide whether to restore stdout
|
||||||
// freopen("/dev/tty", "a", stderr);
|
// freopen("/dev/tty", "a", stderr); // decide whether to restore stderr both need automating
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue