5 #include "nta/Logger.h"
10 size_t Logger::m_tabs = 0;
11 const size_t Logger::TAB_SIZE = 4;
18 std::string tabs(m_tabs,
' ');
20 std::stringstream logEntry;
21 logEntry<<std::fixed<<std::setprecision(3);
22 logEntry<<SDL_GetTicks()/1000.<<
" seconds: "<<tabs<<entry;
32 const std::string err_indicator =
47 if (m_tabs >= tab_size) m_tabs -= tab_size;
50 ScopeLog::ScopeLog(crstring entry, crstring exit) : on_exit(exit) {
54 ScopeLog::~ScopeLog() {
static void push_error(const Error &err)
Adds and error to the front of the list.
std::string get_errortype_string(ErrorType t)
converts ErrorType enum to string
static void writeToLog(crstring entry)
writes an entry in the log
static void unindent(size_t tab_size=TAB_SIZE)
unindents entries
std::ostream & unlock_stream(std::ostream &stream)
Unlock stream.
std::ostream & lock_stream(std::ostream &stream)
Lock stream for thread-safe manipulation.
static std::ofstream m_logFile
the file that keeps the external log
static Error writeErrorToLog(crstring error, ErrorType type=OTHER)
writes entry in log and then notifies ErrorManager
static void createLog()
creates the log
static std::ostream * m_secondLog
Optional secondary stream to log data to as well.
static void indent(size_t tab_size=TAB_SIZE)
indents entries