Revision 161
formatting stuff
Log.cpp | ||
---|---|---|
2 | 2 |
* @file Log.cpp |
3 | 3 |
* |
4 | 4 |
* @brief This file contains the code to do logging for Colonet |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* @author Jason Knichel |
7 | 7 |
* |
8 | 8 |
*/ |
... | ... | |
52 | 52 |
struct tm Log::get_current_time() { |
53 | 53 |
struct tm current_time; |
54 | 54 |
memset(¤t_time, 0, sizeof(struct tm)); |
55 |
|
|
55 |
|
|
56 | 56 |
time_t t = time(NULL); |
57 | 57 |
localtime_r(&t, ¤t_time); |
58 |
|
|
59 |
return current_time;
|
|
58 |
|
|
59 |
return current_time; |
|
60 | 60 |
} |
61 | 61 |
|
62 | 62 |
/** |
... | ... | |
77 | 77 |
fprintf(stderr, "Tried to log a null message.\n"); |
78 | 78 |
return -1; |
79 | 79 |
} |
80 |
|
|
80 |
|
|
81 | 81 |
static char * start_log = "Starting Log"; |
82 | 82 |
static char * connect = "Client Connecting"; |
83 | 83 |
static char * disconnect = "Client Disconnecting"; |
... | ... | |
108 | 108 |
} |
109 | 109 |
|
110 | 110 |
struct tm current_time = get_current_time(); |
111 |
|
|
111 |
|
|
112 | 112 |
char buffer[LOG_MAX_TIME_LENGTH]; |
113 | 113 |
asctime_r(¤t_time, buffer); |
114 | 114 |
int len = strlen(buffer); |
... | ... | |
134 | 134 |
* @brief An easier way to log a normal message |
135 | 135 |
* |
136 | 136 |
* @param message The message to log as a normal message |
137 |
*
|
|
137 |
* |
|
138 | 138 |
* @return 0 on success, negative error code on error |
139 | 139 |
*/ |
140 | 140 |
int Log::log_message(char * message) { |
Also available in: Unified diff