Cytopia
0.3
A city building simulation game
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
Functions
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
z
~
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Typedefs
a
c
d
e
g
i
m
n
p
r
s
t
u
v
Enumerations
Enumerator
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
z
Functions
b
c
d
f
g
i
m
o
p
r
s
t
w
Variables
a
c
d
g
h
i
l
m
n
r
s
t
Typedefs
a
c
d
e
f
g
i
j
l
m
n
r
s
t
v
Enumerations
Enumerator
a
b
d
e
f
g
l
m
n
p
r
s
t
u
w
z
Macros
_
c
e
i
l
n
r
s
t
v
Examples
▼
Cytopia
Todo List
►
Namespaces
►
Classes
▼
Files
▼
File List
▼
src
►
engine
►
game
►
scripting
►
services
▼
util
►
android
►
desktop
►
Exception.cxx
►
Exception.hxx
Filesystem.cxx
►
Filesystem.hxx
►
IEquatable.hxx
IEquatable.inl.hxx
LOG.cxx
►
LOG.hxx
LOG.inl.hxx
►
Meta.hxx
►
OSystem.cxx
►
OSystem.hxx
►
PriorityQueue.hxx
PriorityQueue.inl.hxx
►
Signal.hxx
►
SignalMediator.hxx
►
Singleton.hxx
►
windows
Game.cxx
►
Game.hxx
►
main.cxx
►
MainMenu.cxx
►
MainMenu.hxx
phc.hxx
►
File Members
►
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
LOG.hxx
Go to the documentation of this file.
1
#ifndef LOG_HXX_
2
#define LOG_HXX_
3
4
#include <string>
5
#include "
Exception.hxx
"
6
7
#include <iostream>
8
#include <chrono>
9
#include <ctime>
10
#include <fstream>
11
#include <sstream>
12
#include <SDL.h>
13
#include <algorithm>
14
#include <mutex>
15
16
#include "
Meta.hxx
"
17
18
using
std::string
;
19
using
std::stringstream;
20
using
Mutex
= std::mutex;
21
using
LockGuard
= std::lock_guard<Mutex>;
22
23
enum
LogType
24
{
25
LOG_INFO
= 0,
26
LOG_DEBUG
,
27
LOG_WARNING
,
28
LOG_ERROR
,
29
LOG_FATAL
,
30
};
31
32
class
LOG
33
{
34
35
/* Mutex */
36
static
Mutex
StreamMutex
;
37
38
static
constexpr
const
char
*
LOG_PREFIX_COLORED
[] = {
39
" - \x1B[38;5;39m\x1B[1m[INFO]\x1B[0m - "
,
" - \x1B[38;5;57m\x1B[1m[DEBUG]\x1B[0m - "
,
40
" - \x1B[38;5;214m\x1B[1m[WARNING]\x1B[0m - "
,
" - \x1B[38;5;196m\x1B[1m[ERROR]\x1B[0m - "
,
41
" - \x1B[38;5;124m\x1B[1m[FATAL]\x1B[0m - "
,
42
};
43
44
static
constexpr
const
char
*
LOG_PREFIX
[] = {
45
" - [INFO] - "
,
" - [DEBUG] - "
,
" - [WARNING] - "
,
" - [ERROR] - "
,
" - [FATAL] - "
,
46
};
47
48
public
:
49
/* 1 MB */
50
using
MAX_LOG_SIZE_BYTES
=
Constant<1000000>
;
51
55
LOG
(
LogType
type);
56
60
~LOG
();
61
66
template
<
class
Object>
LOG
&
operator<<
(
const
Object &msg);
67
68
private
:
69
LogType
m_LogType
;
70
std::ostringstream
m_Logger
;
71
75
const
std::string
getTimeStamp
();
76
81
void
writeErrorLog
(
const
std::string
&errorMessage)
const
;
82
};
83
84
#include "
LOG.inl.hxx
"
85
86
#undef _CRT_SECURE_NO_WARNINGS
87
88
#endif
Constant
Constant::value returns the value.
LOG::getTimeStamp
const std::string getTimeStamp()
Gets formatted TimeStamp.
Definition:
LOG.cxx:41
LOG
Definition:
LOG.hxx:32
LockGuard
std::lock_guard< Mutex > LockGuard
Definition:
LOG.hxx:21
LOG_FATAL
@ LOG_FATAL
Definition:
LOG.hxx:29
LOG_INFO
@ LOG_INFO
Definition:
LOG.hxx:25
LOG::StreamMutex
static Mutex StreamMutex
Definition:
LOG.hxx:36
LOG::LOG_PREFIX
static constexpr const char * LOG_PREFIX[]
Definition:
LOG.hxx:44
LOG::writeErrorLog
void writeErrorLog(const std::string &errorMessage) const
Write log message to error.log file.
Definition:
LOG.cxx:49
LOG::LOG
LOG(LogType type)
Create a Logger.
Definition:
LOG.cxx:12
LOG_ERROR
@ LOG_ERROR
Definition:
LOG.hxx:28
Mutex
std::mutex Mutex
Definition:
MessageQueue.hxx:12
LOG_DEBUG
@ LOG_DEBUG
Definition:
LOG.hxx:26
LogType
LogType
Definition:
LOG.hxx:23
LOG::LOG_PREFIX_COLORED
static constexpr const char * LOG_PREFIX_COLORED[]
Definition:
LOG.hxx:38
LOG::m_LogType
LogType m_LogType
Definition:
LOG.hxx:69
Meta.hxx
LOG.inl.hxx
LOG::~LOG
~LOG()
Destroy a Logger.
Definition:
LOG.cxx:14
LOG::m_Logger
std::ostringstream m_Logger
Definition:
LOG.hxx:70
Exception.hxx
LOG::operator<<
LOG & operator<<(const Object &msg)
Log a message.
Definition:
LOG.inl.hxx:2
string
std::string string
Definition:
AudioConfig.hxx:14
LOG_WARNING
@ LOG_WARNING
Definition:
LOG.hxx:27
src
util
LOG.hxx
Generated on Sun Nov 27 2022 09:50:52 for Cytopia by
1.8.17