forked from DonLakeFlyer/MavlinkTagController
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.cpp
34 lines (31 loc) · 881 Bytes
/
log.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "log.h"
#define ANSI_COLOR_RED "\x1b[31m"
#define ANSI_COLOR_GREEN "\x1b[32m"
#define ANSI_COLOR_YELLOW "\x1b[33m"
#define ANSI_COLOR_BLUE "\x1b[34m"
#define ANSI_COLOR_GRAY "\x1b[37m"
#define ANSI_COLOR_RESET "\x1b[0m"
std::mutex LogDetailed::_logMutex;
void set_color(LogColor LogColor)
{
switch (LogColor) {
case LogColor::Red:
std::cout << ANSI_COLOR_RED;
break;
case LogColor::Green:
std::cout << ANSI_COLOR_GREEN;
break;
case LogColor::Yellow:
std::cout << ANSI_COLOR_YELLOW;
break;
case LogColor::Blue:
std::cout << ANSI_COLOR_BLUE;
break;
case LogColor::Gray:
std::cout << ANSI_COLOR_GRAY;
break;
case LogColor::Reset:
std::cout << ANSI_COLOR_RESET;
break;
}
}