[+] Added critical log level

[*] Fix win32 DELETE bug
This commit is contained in:
Reece Wilson 2023-04-16 23:38:31 +01:00
parent 5d979bff6d
commit 4cac821fbb
3 changed files with 27 additions and 7 deletions

View File

@ -18,7 +18,8 @@ namespace Aurora::Logging
eVerbose, eVerbose,
eError, eError,
eDebug, eDebug,
eWarn eWarn,
eCritical
)); ));
static auto const kLogLevelDefault = static_cast<AuUInt8>(kELogLevelMinLegal); static auto const kLogLevelDefault = static_cast<AuUInt8>(kELogLevelMinLegal);
@ -86,6 +87,12 @@ namespace Aurora::Logging
WriteLinef(static_cast<AuUInt8>(ELogLevel::eWarn), EAnsiColor::eRed, "Warn", line, AuForward<T>(args)...); WriteLinef(static_cast<AuUInt8>(ELogLevel::eWarn), EAnsiColor::eRed, "Warn", line, AuForward<T>(args)...);
} }
template<typename ... T>
inline void LogCritical(const AuString &line, T&& ... args)
{
WriteLinef(static_cast<AuUInt8>(ELogLevel::eCritical), EAnsiColor::eBoldRed, "Warn", line, AuForward<T>(args)...);
}
template<typename ... T> template<typename ... T>
inline void LogError(const AuString &line, T&& ... args) inline void LogError(const AuString &line, T&& ... args)
{ {

View File

@ -119,6 +119,12 @@ namespace Aurora::Logging
WriteLinef(static_cast<AuUInt8>(ELogLevel::eError), EAnsiColor::eBoldRed, "Error", line, AuForward<T>(args)...); WriteLinef(static_cast<AuUInt8>(ELogLevel::eError), EAnsiColor::eBoldRed, "Error", line, AuForward<T>(args)...);
} }
template<typename Line_t, typename ... T>
inline void LogCritical(const Line_t &line, T&& ... args)
{
WriteLinef(static_cast<AuUInt8>(ELogLevel::eCritical), EAnsiColor::eBoldRed, "Critical", line, AuForward<T>(args)...);
}
template<typename Line_t, typename ... T> template<typename Line_t, typename ... T>
inline void LogGame(const Line_t &line, T&& ... args) inline void LogGame(const Line_t &line, T&& ... args)
{ {
@ -169,6 +175,12 @@ namespace Aurora::Logging
WriteLine(static_cast<AuUInt8>(ELogLevel::eError), ConsoleMessage(EAnsiColor::eBoldRed, "Error", line)); WriteLine(static_cast<AuUInt8>(ELogLevel::eError), ConsoleMessage(EAnsiColor::eBoldRed, "Error", line));
} }
template<typename Line_t, typename ... T>
inline void LogCritical(const Line_t &line, T&& ... args)
{
WriteLine(static_cast<AuUInt8>(ELogLevel::eCritical), ConsoleMessage(EAnsiColor::eBoldRed, "Critical", line));
}
template<typename Line_t> template<typename Line_t>
static void LogGame(const Line_t &line) static void LogGame(const Line_t &line)
{ {
@ -191,6 +203,7 @@ ADD_AU_GLOBAL_ALIAS(Warn)
ADD_AU_GLOBAL_ALIAS(Error) ADD_AU_GLOBAL_ALIAS(Error)
ADD_AU_GLOBAL_ALIAS(Game) ADD_AU_GLOBAL_ALIAS(Game)
ADD_AU_GLOBAL_ALIAS(Verbose) ADD_AU_GLOBAL_ALIAS(Verbose)
ADD_AU_GLOBAL_ALIAS(Critical)
#if defined(STAGING) || defined(DEBUG) #if defined(STAGING) || defined(DEBUG)
ADD_AU_GLOBAL_ALIAS(VerboseNoShip) ADD_AU_GLOBAL_ALIAS(VerboseNoShip)

View File

@ -252,7 +252,7 @@ namespace Aurora::IO::FS
if (bCheck) if (bCheck)
{ {
fileHandle = ::CreateFileW(win32Path.c_str(), fileHandle = ::CreateFileW(win32Path.c_str(),
GENERIC_WRITE | GENERIC_READ, GENERIC_WRITE | GENERIC_READ | DELETE,
NULL, NULL,
NULL, NULL,
CREATE_NEW, CREATE_NEW,
@ -261,10 +261,10 @@ namespace Aurora::IO::FS
} }
else else
{ {
fileHandle = CreateFileW(win32Path.c_str(), GENERIC_WRITE | GENERIC_READ, dwShare, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); fileHandle = CreateFileW(win32Path.c_str(), GENERIC_WRITE | GENERIC_READ | DELETE, dwShare, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (fileHandle == INVALID_HANDLE_VALUE) if (fileHandle == INVALID_HANDLE_VALUE)
{ {
fileHandle = CreateFileW(win32Path.c_str(), GENERIC_WRITE, dwShare, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); fileHandle = CreateFileW(win32Path.c_str(), GENERIC_WRITE | DELETE, dwShare, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
} }
} }
@ -277,7 +277,7 @@ namespace Aurora::IO::FS
if (bCheck) if (bCheck)
{ {
fileHandle = ::CreateFileW(win32Path.c_str(), fileHandle = ::CreateFileW(win32Path.c_str(),
GENERIC_WRITE, GENERIC_WRITE | DELETE,
NULL, NULL,
NULL, NULL,
CREATE_NEW, CREATE_NEW,
@ -286,10 +286,10 @@ namespace Aurora::IO::FS
} }
else else
{ {
fileHandle = CreateFileW(win32Path.c_str(), GENERIC_WRITE | FILE_READ_ATTRIBUTES, dwShare, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); fileHandle = CreateFileW(win32Path.c_str(), GENERIC_WRITE | FILE_READ_ATTRIBUTES | DELETE, dwShare, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (fileHandle == INVALID_HANDLE_VALUE) if (fileHandle == INVALID_HANDLE_VALUE)
{ {
fileHandle = CreateFileW(win32Path.c_str(), GENERIC_WRITE, dwShare, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); fileHandle = CreateFileW(win32Path.c_str(), GENERIC_WRITE | DELETE, dwShare, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
} }
} }
break; break;