Merge pull request #6110 from aws-lumberyard-dev/Atom/guthadam/update_trace_logger_to_clear_log
Changing trace logger to clear log file when opened
This commit is contained in:
@@ -50,7 +50,7 @@ namespace AzToolsFramework
|
||||
return false;
|
||||
}
|
||||
|
||||
void TraceLogger::PrepareLogFile(const AZStd::string& logFileName)
|
||||
void TraceLogger::OpenLogFile(const AZStd::string& logFileName, bool clearLogFile)
|
||||
{
|
||||
using namespace AzFramework;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace AzToolsFramework
|
||||
AZStd::string logPath;
|
||||
StringFunc::Path::Join(logDirectory.c_str(), logFileName.c_str(), logPath);
|
||||
|
||||
m_logFile.reset(aznew LogFile(logPath.c_str()));
|
||||
m_logFile.reset(aznew LogFile(logPath.c_str(), clearLogFile));
|
||||
if (m_logFile)
|
||||
{
|
||||
m_logFile->SetMachineReadable(false);
|
||||
@@ -81,7 +81,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
m_logFile->AppendLog(LogFile::SEV_NORMAL, message.window.c_str(), message.message.c_str());
|
||||
}
|
||||
m_startupLogSink = {};
|
||||
m_startupLogSink.clear();
|
||||
m_logFile->FlushLog();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace AzToolsFramework
|
||||
~TraceLogger();
|
||||
|
||||
//! Open log file and dump log sink into it
|
||||
void PrepareLogFile(const AZStd::string& logFileName);
|
||||
void OpenLogFile(const AZStd::string& logFileName, bool clearLogFile);
|
||||
|
||||
//! Add filter to ignore messages for windows with matching names
|
||||
void AddWindowFilter(const AZStd::string& filter);
|
||||
@@ -55,7 +55,8 @@ namespace AzToolsFramework
|
||||
AZStd::string window;
|
||||
AZStd::string message;
|
||||
};
|
||||
AZStd::vector<LogMessage> m_startupLogSink;
|
||||
|
||||
AZStd::list<LogMessage> m_startupLogSink;
|
||||
AZStd::unordered_set<AZStd::string> m_windowFilters;
|
||||
AZStd::unordered_set<AZStd::string> m_messageFilters;
|
||||
AZStd::unique_ptr<AzFramework::LogFile> m_logFile;
|
||||
|
||||
@@ -175,7 +175,8 @@ namespace AtomToolsFramework
|
||||
|
||||
Base::StartCommon(systemEntity);
|
||||
|
||||
m_traceLogger.PrepareLogFile(GetBuildTargetName() + ".log");
|
||||
const bool clearLogFile = GetSettingOrDefault("/O3DE/AtomToolsFramework/Application/ClearLogOnStart", false);
|
||||
m_traceLogger.OpenLogFile(GetBuildTargetName() + ".log", clearLogFile);
|
||||
|
||||
AzToolsFramework::AssetDatabase::AssetDatabaseRequestsBus::Handler::BusConnect();
|
||||
AzToolsFramework::AssetBrowser::AssetDatabaseLocationNotificationBus::Broadcast(
|
||||
|
||||
Reference in New Issue
Block a user