|
30 | 30 |
|
31 | 31 | #include "ur_client_library/default_log_handler.h" |
32 | 32 | #include <stdio.h> |
33 | | -#include <chrono> |
34 | 33 |
|
35 | 34 | namespace urcl |
36 | 35 | { |
37 | 36 | DefaultLogHandler::DefaultLogHandler() = default; |
38 | 37 |
|
39 | 38 | void DefaultLogHandler::log(const char* file, int line, LogLevel loglevel, const char* log) |
40 | 39 | { |
41 | | - time_t timestamp = time(NULL); |
42 | | - double time = |
43 | | - std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()) |
44 | | - .count() / |
45 | | - 1000.0; |
46 | | - |
47 | | - const char color_red[] = "\033[31m"; |
48 | | - const char color_orange[] = "\033[93m"; |
49 | | - const char color_none[] = "\033[39m"; |
50 | 40 | switch (loglevel) |
51 | 41 | { |
52 | 42 | case LogLevel::INFO: |
53 | | - printf("%f: %s%s %i: %s \n", time, "INFO ", file, line, log); |
| 43 | + printf("%s%s %i: %s \n", "INFO ", file, line, log); |
54 | 44 | break; |
55 | 45 | case LogLevel::DEBUG: |
56 | 46 | printf("%s%s %i: %s \n", "DEBUG ", file, line, log); |
57 | 47 | break; |
58 | 48 | case LogLevel::WARN: |
59 | | - printf("%s%f: %s%s %i: %s%s\n", color_orange, time, "WARN ", file, line, log, color_none); |
| 49 | + printf("%s%s %i: %s \n", "WARN ", file, line, log); |
60 | 50 | break; |
61 | 51 | case LogLevel::ERROR: |
62 | | - printf("%s%f: %s%s %i: %s%s\n", color_red, time, "ERROR ", file, line, log, color_none); |
| 52 | + printf("%s%s %i: %s \n", "ERROR ", file, line, log); |
63 | 53 | break; |
64 | 54 | case LogLevel::FATAL: |
65 | | - printf("%s%s%s %i: %s%s\n", "FATAL ", color_red, file, line, log, color_none); |
| 55 | + printf("%s%s %i: %s \n", "FATAL ", file, line, log); |
66 | 56 | break; |
67 | 57 | default: |
68 | 58 | break; |
|
0 commit comments