MCPcopy Create free account
hub / github.com/ddnet/ddnet / websocket_log_callback

Function websocket_log_callback

src/engine/shared/websockets.cpp:216–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216static void websocket_log_callback(int level, const char *line)
217{
218 // Truncate duplicate timestamp from beginning and newline from end
219 char line_truncated[4096]; // Longest log line length
220 const char *line_time_end = str_find(line, "] ");
221 dbg_assert(line_time_end != nullptr, "unexpected log format");
222 str_copy(line_truncated, line_time_end + 2);
223 const int length = str_length(line_truncated);
224 if(line_truncated[length - 1] == '\n')
225 {
226 line_truncated[length - 1] = '\0';
227 }
228 if(line_truncated[length - 2] == '\r')
229 {
230 line_truncated[length - 2] = '\0';
231 }
232 log_log(websocket_level_to_loglevel(level), "websockets", "%s", line_truncated);
233}
234
235void websocket_init()
236{

Callers

nothing calls this directly

Calls 5

str_findFunction · 0.85
str_lengthFunction · 0.85
log_logFunction · 0.85
str_copyFunction · 0.50

Tested by

no test coverage detected