aboutsummaryrefslogtreecommitdiff
path: root/src/common/Logging/Log.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-12-24 13:08:41 +0100
committerShauren <shauren.trinity@gmail.com>2016-12-24 13:09:12 +0100
commit0c9bfd074d94aa7092164c809219203c95c275a8 (patch)
tree8dd152f00aa3ae0fe53b4360824de1b6a2e728f7 /src/common/Logging/Log.cpp
parent6c75f96b0cf7035df894824e1b607f4f1b105872 (diff)
Core/Logging: Fix static analysis issue
CID 1367942, 1367944, 1367953,1367955,1367957, 1367958, 1367960, 1367961, 1367962, 1367964
Diffstat (limited to 'src/common/Logging/Log.cpp')
-rw-r--r--src/common/Logging/Log.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp
index f7a84fb8b47..de1deb3d69d 100644
--- a/src/common/Logging/Log.cpp
+++ b/src/common/Logging/Log.cpp
@@ -251,8 +251,17 @@ std::string Log::GetTimestampStr()
// HH hour (2 digits 00-23)
// MM minutes (2 digits 00-59)
// SS seconds (2 digits 00-59)
- return Trinity::StringFormat("%04d-%02d-%02d_%02d-%02d-%02d",
- aTm.tm_year + 1900, aTm.tm_mon + 1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
+ try
+ {
+ return Trinity::StringFormat("%04d-%02d-%02d_%02d-%02d-%02d",
+ aTm.tm_year + 1900, aTm.tm_mon + 1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
+ }
+ catch (std::exception const& ex)
+ {
+ fprintf(stderr, "Failed to initialize timestamp part of log filename! %s", ex.what());
+ fflush(stderr);
+ ABORT();
+ }
}
bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLogger /* = true */)