Browse Source
shorten
Signed-off-by: crueter <crueter@eden-emu.dev>
pull/3021/head
crueter
3 months ago
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
1 changed files with
5 additions and
9 deletions
-
src/common/logging/backend.cpp
|
|
|
@ -112,17 +112,13 @@ public: |
|
|
|
// This must be a static otherwise it would get checked on EVERY
|
|
|
|
// instance of logging an entry...
|
|
|
|
static std::string username = []() -> std::string { |
|
|
|
const char* s = getenv("USER"); |
|
|
|
if (s == nullptr) |
|
|
|
s = getenv("USERNAME"); |
|
|
|
char* s; |
|
|
|
|
|
|
|
if (s == nullptr) |
|
|
|
s = getenv("LOGNAME"); |
|
|
|
if ((s = getenv("USER")) != nullptr || (s = getenv("USERNAME")) != nullptr |
|
|
|
|| (s = getenv("LOGNAME")) != nullptr) |
|
|
|
return std::string{s}; |
|
|
|
|
|
|
|
if (s == nullptr) |
|
|
|
return std::string{}; |
|
|
|
|
|
|
|
return std::string{s}; |
|
|
|
return std::string{}; |
|
|
|
}(); |
|
|
|
if (!username.empty()) |
|
|
|
boost::replace_all(message, username, "user"); |
|
|
|
|