MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / xlog_2

Function xlog_2

xlog.c:274–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272
273
274int xlog_2(struct sip_msg* msg, char* lev, char* frm)
275{
276 int log_len, ret;
277 long level;
278 xl_level_p xlp;
279 pv_value_t value;
280
281 xlp = (xl_level_t*)(void*)lev;
282 if(xlp->type==1)
283 {
284 if(pv_get_spec_value(msg, &xlp->v.sp, &value)!=0
285 || value.flags&PV_VAL_NULL || !(value.flags&PV_VAL_INT))
286 {
287 LM_ERR("invalid log level value [%d]\n", value.flags);
288 return -1;
289 }
290 level = (long)value.ri;
291 } else {
292 level = xlp->v.level;
293 }
294
295 if(!is_xlog_printable((int)level))
296 return 1;
297
298 log_len = xlog_buf_size;
299
300 ret = xl_print_log(msg, (pv_elem_t*)(void*)frm, &log_len);
301 if (ret == -1) {
302 LM_ERR("global print buffer too small, increase 'xlog_buf_size'\n");
303 return -1;
304 }
305
306 /* set the xlog as log level to trick "LM_GEN" */
307 set_proc_log_level( *xlog_level );
308
309 /* log_buf[log_len] = '\0'; */
310 LM_GEN1((int)level, "%.*s", log_len, log_buf);
311
312 reset_proc_log_level();
313
314 return ret;
315}
316
317
318int xlog_1(struct sip_msg* msg, char* frm)

Callers 1

do_actionFunction · 0.85

Calls 4

pv_get_spec_valueFunction · 0.85
xl_print_logFunction · 0.85
set_proc_log_levelFunction · 0.85
reset_proc_log_levelFunction · 0.85

Tested by

no test coverage detected