| 214 | } |
| 215 | |
| 216 | static 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 | |
| 235 | void websocket_init() |
| 236 | { |
nothing calls this directly
no test coverage detected