blob: e9c5a4b8f3b0437f0716c0b9d965b80130ce7d37 [file] [log] [blame]
Brian Silverman890a32a2018-03-11 15:41:56 -07001#include "ctre/phoenix/CTRLogger.h"
2#include "ctre/phoenix/CCI/Logger_CCI.h" // c_Logger_*
3#include <execinfo.h>
4
5namespace ctre {
6namespace phoenix {
7
8void CTRLogger::Open(int language) {
9 c_Logger_Open(language, true);
10}
11ErrorCode CTRLogger::Log(ErrorCode code, std::string origin) {
12 void *buf[100];
13 char **strings;
14 int size = backtrace(buf, 100);
15 strings = backtrace_symbols(buf, size);
16 std::string stackTrace;
17 for (int i = 1; i < size; i++) {
18 stackTrace += strings[i];
19 stackTrace += "\n";
20 }
21 return c_Logger_Log(code, origin.c_str(), 3, stackTrace.c_str());
22}
23void CTRLogger::Close() {
24 c_Logger_Close();
25}
26//void CTRLogger::Description(ErrorCode code, const char *&shrt, const char *&lng) {
27// c_Logger_Description(code, shrt, lng);
28//}
29
30}
31}