AuroraRuntime/Include/Aurora/Console/ConsoleMessage.hpp

65 lines
1.7 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: ConsoleMessage.hpp
Date: 2021-6-10
Author: Reece
***/
#pragma once
namespace Aurora::Threading::Threads
{
AUKN_SYM AuThreadId_t GetThreadId();
}
namespace Aurora::Time
{
AUKN_SYM AuInt64 CurrentClockMS();
}
namespace Aurora::Console
{
struct ConsoleMessage
{
EAnsiColor color;
AuString prefix;
AuString line;
AuInt64 time;
AuThreadId_t tid;
inline ConsoleMessage()
{
color = EAnsiColor::eReset;
tid = 0;
time = 0;
}
inline ConsoleMessage(const AuROString &prefix, const AuROString &line) :
prefix(prefix),
line(line),
color(EAnsiColor::eReset)
{
time = Time::CurrentClockMS();
tid = Threading::Threads::GetThreadId();
}
inline ConsoleMessage(const EAnsiColor color, const AuROString &prefix, const AuROString &line) :
prefix(prefix),
line(line),
color(color)
{
time = Time::CurrentClockMS();
tid = Threading::Threads::GetThreadId();
}
AUKN_SYM void Read(Memory::ByteBuffer &deserialize);
AUKN_SYM void Write(Memory::ByteBuffer &serialize) const;
AUKN_SYM AuString StringifyTime(bool bSimple = false) const;
AUKN_SYM AuString StringifyTimeUTC() const;
AUKN_SYM AuString GetWrappedTag() const;
AUKN_SYM AuString ToConsole() const;
AUKN_SYM AuString ToPersistentString() const;
AUKN_SYM AuString ToSimplified() const;
};
}