Browse code

msg_translator.c: logging: convert LOG to LM_*

Ovidiu Sas authored on 04/10/2014 00:38:22
Showing 1 changed files
... ...
@@ -221,7 +221,7 @@ static int check_via_address(struct ip_addr* ip, str *name,
221 221
 			if (strncmp(name->s, s, name->len)==0)
222 222
 				return 0;
223 223
 	}else{
224
-		LOG(L_CRIT, "check_via_address: BUG: could not convert ip address\n");
224
+		LM_CRIT("could not convert ip address\n");
225 225
 		return -1;
226 226
 	}
227 227
 
... ...
@@ -338,7 +338,7 @@ static char * warning_builder( struct sip_msg *msg, unsigned int *returned_len)
338 338
 	*returned_len=clen;
339 339
 	return buf;
340 340
 error_overflow:
341
-	LOG(L_NOTICE, "NOTICE: warning_builder: buffer size exceeded (probably too long URI)\n");
341
+	LM_NOTICE("buffer size exceeded (probably too long URI)\n");
342 342
 	*returned_len=0;
343 343
 	return 0;
344 344
 }
... ...
@@ -359,7 +359,7 @@ char* received_builder(struct sip_msg *msg, unsigned int *received_len)
359 359
 	buf=pkg_malloc(sizeof(char)*MAX_RECEIVED_SIZE);
360 360
 	if (buf==0){
361 361
 		ser_error=E_OUT_OF_MEM;
362
-		LOG(L_ERR, "ERROR: received_builder: out of memory\n");
362
+		LM_ERR("out of memory\n");
363 363
 		return 0;
364 364
 	}
365 365
 	memcpy(buf, RECEIVED, RECEIVED_LEN);
... ...
@@ -392,7 +392,7 @@ char* rport_builder(struct sip_msg *msg, unsigned int *rport_len)
392 392
 	buf=pkg_malloc(sizeof(char)*(len+1));/* space for null term */
393 393
 	if (buf==0){
394 394
 		ser_error=E_OUT_OF_MEM;
395
-		LOG(L_ERR, "ERROR: rport_builder: out of memory\n");
395
+		LM_ERR("out of memory\n");
396 396
 		return 0;
397 397
 	}
398 398
 	memcpy(buf, RPORT, RPORT_LEN);
... ...
@@ -416,7 +416,7 @@ char* id_builder(struct sip_msg* msg, unsigned int *id_len)
416 416
 	size=sizeof(int)*2;
417 417
 	p=&revhex[0];
418 418
 	if (int2reverse_hex(&p, &size, msg->rcv.proto_reserved1)==-1){
419
-		LOG(L_CRIT, "BUG: id_builder: not enough space for id\n");
419
+		LM_CRIT("not enough space for id\n");
420 420
 		return 0;
421 421
 	}
422 422
 	value_len=p-&revhex[0];
... ...
@@ -424,7 +424,7 @@ char* id_builder(struct sip_msg* msg, unsigned int *id_len)
424 424
 	buf=pkg_malloc(sizeof(char)*(len+1));/* place for ending \0 */
425 425
 	if (buf==0){
426 426
 		ser_error=E_OUT_OF_MEM;
427
-		LOG(L_ERR, "ERROR: id_builder: out of memory\n");
427
+		LM_ERR("out of memory\n");
428 428
 		return 0;
429 429
 	}
430 430
 	memcpy(buf, ID_PARAM, ID_PARAM_LEN);
... ...
@@ -450,8 +450,7 @@ char* clen_builder(	struct sip_msg* msg, int *clen_len, int diff,
450 450
 	body=get_body(msg);
451 451
 	if (body==0){
452 452
 		ser_error=E_BAD_REQ;
453
-		LOG(L_ERR, "ERROR: clen_builder: no message body found"
454
-					" (missing crlf?)");
453
+		LM_ERR("no message body found (missing crlf?)");
455 454
 		return 0;
456 455
 	}
457 456
 	value=msg->len-(int)(body-msg->buf)+diff;
... ...
@@ -467,7 +466,7 @@ char* clen_builder(	struct sip_msg* msg, int *clen_len, int diff,
467 467
 	buf=pkg_malloc(sizeof(char)*(len+1));
468 468
 	if (buf==0){
469 469
 		ser_error=E_OUT_OF_MEM;
470
-		LOG(L_ERR, "ERROR: clen_builder: out of memory\n");
470
+		LM_ERR("out of memory\n");
471 471
 		return 0;
472 472
 	}
473 473
 	if (body_only) {
... ...
@@ -498,7 +497,7 @@ static inline int lump_check_opt(	struct lump *l,
498 498
 
499 499
 #define get_ip_port_proto \
500 500
 			if ((snd_i==0) || (snd_i->send_sock==0)){ \
501
-				LOG(L_CRIT, "ERROR: lump_check_opt: null send socket\n"); \
501
+				LM_CRIT("null send socket\n"); \
502 502
 				return 1; /* we presume they are different :-) */ \
503 503
 			} \
504 504
 			if (msg->rcv.bind_address){ \
... ...
@@ -562,8 +561,7 @@ static inline int lump_check_opt(	struct lump *l,
562 562
 				return 1;
563 563
 			} else return 0;
564 564
 		default:
565
-			LOG(L_CRIT, "BUG: lump:w_check_opt: unknown lump condition %d\n",
566
-					l->u.cond);
565
+			LM_CRIT("unknown lump condition %d\n", l->u.cond);
567 566
 	}
568 567
 	return 0; /* false */
569 568
 }
... ...
@@ -600,8 +598,7 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
600 600
 								new_len+=COMP_PARAM_LEN+SERGZ_NAME_LEN ; \
601 601
 								break; \
602 602
 						default: \
603
-						LOG(L_CRIT, "BUG: lumps_len: unknown comp %d\n", \
604
-								msg->rcv.comp); \
603
+						LM_CRIT("unknown comp %d\n", msg->rcv.comp); \
605 604
 					}
606 605
 
607 606
 	#define SENDCOMP_LUMP_LEN \
... ...
@@ -616,8 +613,7 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
616 616
 								new_len+=COMP_PARAM_LEN+SERGZ_NAME_LEN ; \
617 617
 								break; \
618 618
 						default: \
619
-						LOG(L_CRIT, "BUG: lumps_len: unknown comp %d\n", \
620
-								send_info->comp); \
619
+						LM_CRIT("unknown comp %d\n", send_info->comp); \
621 620
 					}
622 621
 #else
623 622
 	#define RCVCOMP_LUMP_LEN
... ...
@@ -633,7 +629,7 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
633 633
 						new_len+=2; \
634 634
 				}else{ \
635 635
 					/* FIXME */ \
636
-					LOG(L_CRIT, "FIXME: null bind_address\n"); \
636
+					LM_CRIT("FIXME: null bind_address\n"); \
637 637
 				}; \
638 638
 				break; \
639 639
 			case SUBST_RCV_PORT: \
... ...
@@ -641,7 +637,7 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
641 641
 					new_len+=recv_port_str->len; \
642 642
 				}else{ \
643 643
 					/* FIXME */ \
644
-					LOG(L_CRIT, "FIXME: null bind_address\n"); \
644
+					LM_CRIT("FIXME: null bind_address\n"); \
645 645
 				}; \
646 646
 				break; \
647 647
 			case SUBST_RCV_PROTO: \
... ...
@@ -667,12 +663,11 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
667 667
 							new_len+=4; \
668 668
 							break; \
669 669
 						default: \
670
-						LOG(L_CRIT, "BUG: lumps_len: unknown proto %d\n", \
671
-								msg->rcv.bind_address->proto); \
670
+						LM_CRIT("unknown proto %d\n", msg->rcv.bind_address->proto); \
672 671
 					}\
673 672
 				}else{ \
674 673
 					/* FIXME */ \
675
-					LOG(L_CRIT, "FIXME: null bind_address\n"); \
674
+					LM_CRIT("FIXME: null bind_address\n"); \
676 675
 				}; \
677 676
 				break; \
678 677
 			case SUBST_RCV_ALL: \
... ...
@@ -705,13 +700,13 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
705 705
 							new_len+=TRANSPORT_PARAM_LEN+4; \
706 706
 							break; \
707 707
 						default: \
708
-						LOG(L_CRIT, "BUG: lumps_len: unknown proto %d\n", \
708
+						LM_CRIT("unknown proto %d\n", \
709 709
 								msg->rcv.bind_address->proto); \
710 710
 					}\
711 711
 					RCVCOMP_LUMP_LEN \
712 712
 				}else{ \
713 713
 					/* FIXME */ \
714
-					LOG(L_CRIT, "FIXME: null bind_address\n"); \
714
+					LM_CRIT("FIXME: null bind_address\n"); \
715 715
 				}; \
716 716
 				break; \
717 717
 			case SUBST_SND_IP: \
... ...
@@ -721,16 +716,14 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
721 721
 							send_address_str==&(send_sock->address_str)) \
722 722
 						new_len+=2; \
723 723
 				}else{ \
724
-					LOG(L_CRIT, "FIXME: lumps_len called with" \
725
-							" null send_sock\n"); \
724
+					LM_CRIT("FIXME: null send_sock\n"); \
726 725
 				}; \
727 726
 				break; \
728 727
 			case SUBST_SND_PORT: \
729 728
 				if (send_sock){ \
730 729
 					new_len+=send_port_str->len; \
731 730
 				}else{ \
732
-					LOG(L_CRIT, "FIXME: lumps_len called with" \
733
-							" null send_sock\n"); \
731
+					LM_CRIT("FIXME: null send_sock\n"); \
734 732
 				}; \
735 733
 				break; \
736 734
 			case SUBST_SND_PROTO: \
... ...
@@ -756,12 +749,10 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
756 756
 							new_len+=4; \
757 757
 							break; \
758 758
 						default: \
759
-						LOG(L_CRIT, "BUG: lumps_len: unknown proto %d\n", \
760
-								send_sock->proto); \
759
+						LM_CRIT("unknown proto %d\n", send_sock->proto); \
761 760
 					}\
762 761
 				}else{ \
763
-					LOG(L_CRIT, "FIXME: lumps_len called with" \
764
-							" null send_sock\n"); \
762
+					LM_CRIT("FIXME: null send_sock\n"); \
765 763
 				}; \
766 764
 				break; \
767 765
 			case SUBST_SND_ALL: \
... ...
@@ -796,21 +787,18 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
796 796
 							new_len+=TRANSPORT_PARAM_LEN+4; \
797 797
 							break; \
798 798
 						default: \
799
-						LOG(L_CRIT, "BUG: lumps_len: unknown proto %d\n", \
800
-								send_sock->proto); \
799
+						LM_CRIT("unknown proto %d\n", send_sock->proto); \
801 800
 					}\
802 801
 					SENDCOMP_LUMP_LEN \
803 802
 				}else{ \
804 803
 					/* FIXME */ \
805
-					LOG(L_CRIT, "FIXME: lumps_len called with" \
806
-							" null send_sock\n"); \
804
+					LM_CRIT("FIXME: null send_sock\n"); \
807 805
 				}; \
808 806
 				break; \
809 807
 			case SUBST_NOP: /* do nothing */ \
810 808
 				break; \
811 809
 			default: \
812
-				LOG(L_CRIT, "BUG: unknown subst type %d\n", \
813
-						(subst_l)->u.subst); \
810
+				LM_CRIT("unknown subst type %d\n", (subst_l)->u.subst); \
814 811
 		}
815 812
 	
816 813
 	if (send_info){
... ...
@@ -868,8 +856,7 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
868 868
 					break;
869 869
 				default:
870 870
 					/* only ADD allowed for before/after */
871
-						LOG(L_CRIT, "BUG: lumps_len: invalid op "
872
-							"for data lump (%x)\n", r->op);
871
+						LM_CRIT("invalid op for data lump (%x)\n", r->op);
873 872
 			}
874 873
 		}
875 874
 skip_before:
... ...
@@ -905,8 +892,7 @@ skip_before:
905 905
 				/* do nothing */
906 906
 				break;
907 907
 			default:
908
-				LOG(L_CRIT,"BUG:lumps_len: invalid"
909
-							" op for data lump (%x)\n", r->op);
908
+				LM_CRIT("invalid op for data lump (%x)\n", r->op);
910 909
 		}
911 910
 		for (r=t->after;r;r=r->after){
912 911
 			switch(r->op){
... ...
@@ -924,8 +910,7 @@ skip_before:
924 924
 					break;
925 925
 				default:
926 926
 					/* only ADD allowed for before/after */
927
-					LOG(L_CRIT, "BUG:lumps_len: invalid"
928
-								" op for data lump (%x)\n", r->op);
927
+					LM_CRIT("invalid op for data lump (%x)\n", r->op);
929 928
 			}
930 929
 		}
931 930
 skip_after:
... ...
@@ -981,8 +966,7 @@ static inline void process_lumps(	struct sip_msg* msg,
981 981
 						offset+=SERGZ_NAME_LEN; \
982 982
 						break;\
983 983
 					default:\
984
-						LOG(L_CRIT, "BUG: process_lumps: unknown comp %d\n", \
985
-								msg->rcv.comp); \
984
+						LM_CRIT("unknown comp %d\n", msg->rcv.comp); \
986 985
 				}
987 986
 	
988 987
 	#define SENDCOMP_PARAM_ADD \
... ...
@@ -1004,8 +988,7 @@ static inline void process_lumps(	struct sip_msg* msg,
1004 1004
 						offset+=SERGZ_NAME_LEN; \
1005 1005
 						break;\
1006 1006
 					default:\
1007
-						LOG(L_CRIT, "BUG: process_lumps: unknown comp %d\n", \
1008
-								msg->rcv.comp); \
1007
+						LM_CRIT("unknown comp %d\n", msg->rcv.comp); \
1009 1008
 				} 
1010 1009
 #else
1011 1010
 	#define RCVCOMP_PARAM_ADD
... ...
@@ -1027,7 +1010,7 @@ static inline void process_lumps(	struct sip_msg* msg,
1027 1027
 				}\
1028 1028
 			}else{  \
1029 1029
 				/*FIXME*/ \
1030
-				LOG(L_CRIT, "FIXME: process_lumps: null bind_address\n"); \
1030
+				LM_CRIT("FIXME: null bind_address\n"); \
1031 1031
 			}; \
1032 1032
 			break; \
1033 1033
 		case SUBST_RCV_PORT: \
... ...
@@ -1037,7 +1020,7 @@ static inline void process_lumps(	struct sip_msg* msg,
1037 1037
 				offset+=recv_port_str->len; \
1038 1038
 			}else{  \
1039 1039
 				/*FIXME*/ \
1040
-				LOG(L_CRIT, "FIXME: process_lumps: null bind_address\n"); \
1040
+				LM_CRIT("FIXME: null bind_address\n"); \
1041 1041
 			}; \
1042 1042
 			break; \
1043 1043
 		case SUBST_RCV_ALL: \
... ...
@@ -1096,13 +1079,12 @@ static inline void process_lumps(	struct sip_msg* msg,
1096 1096
 						offset+=4; \
1097 1097
 						break; \
1098 1098
 					default: \
1099
-						LOG(L_CRIT, "BUG: process_lumps: unknown proto %d\n", \
1100
-								msg->rcv.bind_address->proto); \
1099
+						LM_CRIT("unknown proto %d\n", msg->rcv.bind_address->proto); \
1101 1100
 				} \
1102 1101
 				RCVCOMP_PARAM_ADD \
1103 1102
 			}else{  \
1104 1103
 				/*FIXME*/ \
1105
-				LOG(L_CRIT, "FIXME: process_lumps: null bind_address\n"); \
1104
+				LM_CRIT("FIXME: null bind_address\n"); \
1106 1105
 			}; \
1107 1106
 			break; \
1108 1107
 		case SUBST_SND_IP: \
... ...
@@ -1120,8 +1102,7 @@ static inline void process_lumps(	struct sip_msg* msg,
1120 1120
 				}\
1121 1121
 			}else{  \
1122 1122
 				/*FIXME*/ \
1123
-				LOG(L_CRIT, "FIXME: process_lumps: called with" \
1124
-							" null send_sock\n"); \
1123
+				LM_CRIT("FIXME: null send_sock\n"); \
1125 1124
 			}; \
1126 1125
 			break; \
1127 1126
 		case SUBST_SND_PORT: \
... ...
@@ -1131,8 +1112,7 @@ static inline void process_lumps(	struct sip_msg* msg,
1131 1131
 				offset+=send_port_str->len; \
1132 1132
 			}else{  \
1133 1133
 				/*FIXME*/ \
1134
-				LOG(L_CRIT, "FIXME: process_lumps: called with" \
1135
-						" null send_sock\n"); \
1134
+				LM_CRIT("FIXME: null send_sock\n"); \
1136 1135
 			}; \
1137 1136
 			break; \
1138 1137
 		case SUBST_SND_ALL: \
... ...
@@ -1193,13 +1173,12 @@ static inline void process_lumps(	struct sip_msg* msg,
1193 1193
 						offset+=4; \
1194 1194
 						break; \
1195 1195
 					default: \
1196
-						LOG(L_CRIT, "BUG: process_lumps: unknown proto %d\n", \
1197
-								send_sock->proto); \
1196
+						LM_CRIT("unknown proto %d\n", send_sock->proto); \
1198 1197
 				} \
1199 1198
 				SENDCOMP_PARAM_ADD \
1200 1199
 			}else{  \
1201 1200
 				/*FIXME*/ \
1202
-				LOG(L_CRIT, "FIXME: process_lumps: null bind_address\n"); \
1201
+				LM_CRIT("FIXME: null bind_address\n"); \
1203 1202
 			}; \
1204 1203
 			break; \
1205 1204
 		case SUBST_RCV_PROTO: \
... ...
@@ -1233,13 +1212,11 @@ static inline void process_lumps(	struct sip_msg* msg,
1233 1233
 						offset+=4; \
1234 1234
 						break; \
1235 1235
 					default: \
1236
-						LOG(L_CRIT, "BUG: process_lumps: unknown proto %d\n", \
1237
-								msg->rcv.bind_address->proto); \
1236
+						LM_CRIT("unknown proto %d\n", msg->rcv.bind_address->proto); \
1238 1237
 				} \
1239 1238
 			}else{  \
1240 1239
 				/*FIXME*/ \
1241
-				LOG(L_CRIT, "FIXME: process_lumps: called with null" \
1242
-							" send_sock \n"); \
1240
+				LM_CRIT("FIXME: null send_sock \n"); \
1243 1241
 			}; \
1244 1242
 			break; \
1245 1243
 		case  SUBST_SND_PROTO: \
... ...
@@ -1273,18 +1250,15 @@ static inline void process_lumps(	struct sip_msg* msg,
1273 1273
 						offset+=4; \
1274 1274
 						break; \
1275 1275
 					default: \
1276
-						LOG(L_CRIT, "BUG: process_lumps: unknown proto %d\n", \
1277
-								send_sock->proto); \
1276
+						LM_CRIT("unknown proto %d\n", send_sock->proto); \
1278 1277
 				} \
1279 1278
 			}else{  \
1280 1279
 				/*FIXME*/ \
1281
-				LOG(L_CRIT, "FIXME: process_lumps: called with null" \
1282
-							" send_sock \n"); \
1280
+				LM_CRIT("FIXME: null send_sock \n"); \
1283 1281
 			}; \
1284 1282
 			break; \
1285 1283
 		default: \
1286
-				LOG(L_CRIT, "BUG: process_lumps: unknown subst type %d\n", \
1287
-							(subst_l)->u.subst); \
1284
+				LM_CRIT("unknown subst type %d\n", (subst_l)->u.subst); \
1288 1285
 	}
1289 1286
 
1290 1287
 	if (send_info){
... ...
@@ -1363,8 +1337,7 @@ static inline void process_lumps(	struct sip_msg* msg,
1363 1363
 							break;
1364 1364
 						default:
1365 1365
 							/* only ADD allowed for before/after */
1366
-							LOG(L_CRIT, "BUG:process_lumps: "
1367
-									"invalid op for data lump (%x)\n", r->op);
1366
+							LM_CRIT("invalid op for data lump (%x)\n", r->op);
1368 1367
 					}
1369 1368
 				}
1370 1369
 skip_before:
... ...
@@ -1382,8 +1355,7 @@ skip_before:
1382 1382
 						break;
1383 1383
 					default:
1384 1384
 						/* should not ever get here */
1385
-						LOG(L_CRIT, "BUG: process_lumps: unhandled data lump "
1386
-								" op %d\n", t->op);
1385
+						LM_CRIT("unhandled data lump op %d\n", t->op);
1387 1386
 				}
1388 1387
 				/* process after */
1389 1388
 				for(r=t->after;r;r=r->after){
... ...
@@ -1404,8 +1376,7 @@ skip_before:
1404 1404
 							break;
1405 1405
 						default:
1406 1406
 							/* only ADD allowed for before/after */
1407
-							LOG(L_CRIT, "BUG:process_lumps: "
1408
-									"invalid op for data lump (%x)\n", r->op);
1407
+							LM_CRIT("invalid op for data lump (%x)\n", r->op);
1409 1408
 					}
1410 1409
 				}
1411 1410
 skip_after:
... ...
@@ -1445,8 +1416,7 @@ skip_after:
1445 1445
 							break;
1446 1446
 						default:
1447 1447
 							/* only ADD allowed for before/after */
1448
-							LOG(L_CRIT, "BUG:process_lumps: "
1449
-									"invalid op for data lump (%x)\n",r->op);
1448
+							LM_CRIT("invalid op for data lump (%x)\n",r->op);
1450 1449
 					}
1451 1450
 				}
1452 1451
 skip_nop_before:
... ...
@@ -1474,15 +1444,13 @@ skip_nop_before:
1474 1474
 							break;
1475 1475
 						default:
1476 1476
 							/* only ADD allowed for before/after */
1477
-							LOG(L_CRIT, "BUG:process_lumps: "
1478
-									"invalid op for data lump (%x)\n", r->op);
1477
+							LM_CRIT("invalid op for data lump (%x)\n", r->op);
1479 1478
 					}
1480 1479
 				}
1481 1480
 skip_nop_after:
1482 1481
 				break;
1483 1482
 			default:
1484
-					LOG(L_CRIT, "BUG: process_lumps: "
1485
-							"unknown op (%x)\n", t->op);
1483
+					LM_CRIT("unknown op (%x)\n", t->op);
1486 1484
 		}
1487 1485
 	}
1488 1486
 	*new_buf_offs=offset;
... ...
@@ -1522,7 +1490,7 @@ static inline int adjust_clen(struct sip_msg* msg, int body_delta, int proto)
1522 1522
 #endif
1523 1523
 	    ) {
1524 1524
 		if (parse_headers(msg, HDR_CONTENTLENGTH_F, 0)==-1){
1525
-			LOG(L_ERR, "adjust_clen: error parsing content-length\n");
1525
+			LM_ERR("error parsing content-length\n");
1526 1526
 			goto error;
1527 1527
 		}
1528 1528
 		if (unlikely(msg->content_length==0)){
... ...
@@ -1533,7 +1501,7 @@ static inline int adjust_clen(struct sip_msg* msg, int body_delta, int proto)
1533 1533
 			anchor=anchor_lump(msg, msg->unparsed-msg->buf, 0,
1534 1534
 												HDR_CONTENTLENGTH_T);
1535 1535
 			if (anchor==0){
1536
-				LOG(L_ERR, "adjust_clen: cannot set clen anchor\n");
1536
+				LM_ERR("cannot set clen anchor\n");
1537 1537
 				goto error;
1538 1538
 			}
1539 1539
 			body_only=0;
... ...
@@ -1543,8 +1511,7 @@ static inline int adjust_clen(struct sip_msg* msg, int body_delta, int proto)
1543 1543
 			body=get_body(msg);
1544 1544
 			if (unlikely(body==0)){
1545 1545
 				ser_error=E_BAD_REQ;
1546
-				LOG(L_ERR, "adjust_clen: no message body found"
1547
-						" (missing crlf?)");
1546
+				LM_ERR("no message body found (missing crlf?)");
1548 1547
 				goto error;
1549 1548
 			}
1550 1549
 			comp_clen=msg->len-(int)(body-msg->buf)+body_delta;
... ...
@@ -1558,8 +1525,7 @@ static inline int adjust_clen(struct sip_msg* msg, int body_delta, int proto)
1558 1558
 									msg->content_length->body.len,
1559 1559
 									HDR_CONTENTLENGTH_T);
1560 1560
 				if (anchor==0) {
1561
-					LOG(L_ERR, "adjust_clen: Can't remove original"
1562
-								" Content-Length\n");
1561
+					LM_ERR("Can't remove original Content-Length\n");
1563 1562
 					goto error;
1564 1563
 				}
1565 1564
 				body_only=1;
... ...
@@ -1569,7 +1535,7 @@ static inline int adjust_clen(struct sip_msg* msg, int body_delta, int proto)
1569 1569
 #endif /* USE_TCP */
1570 1570
 	if (body_delta){
1571 1571
 		if (parse_headers(msg, HDR_CONTENTLENGTH_F, 0) == -1) {
1572
-			LOG(L_ERR, "adjust_clen: Error parsing Content-Length\n");
1572
+			LM_ERR("Error parsing Content-Length\n");
1573 1573
 			goto error;
1574 1574
 		}
1575 1575
 
... ...
@@ -1587,7 +1553,7 @@ static inline int adjust_clen(struct sip_msg* msg, int body_delta, int proto)
1587 1587
 				anchor=anchor_lump(msg, msg->unparsed-msg->buf, 0,
1588 1588
 													HDR_CONTENTLENGTH_T);
1589 1589
 				if (anchor==0){
1590
-					LOG(L_ERR, "adjust_clen: cannot set clen anchor\n");
1590
+					LM_ERR("cannot set clen anchor\n");
1591 1591
 					goto error;
1592 1592
 				}
1593 1593
 				body_only=0;
... ...
@@ -1600,8 +1566,7 @@ static inline int adjust_clen(struct sip_msg* msg, int body_delta, int proto)
1600 1600
 								msg->content_length->body.len,
1601 1601
 								HDR_CONTENTLENGTH_T);
1602 1602
 			if (anchor==0) {
1603
-				LOG(L_ERR, "adjust_clen: Can't remove original"
1604
-							" Content-Length\n");
1603
+				LM_ERR("Can't remove original Content-Length\n");
1605 1604
 				goto error;
1606 1605
 			}
1607 1606
 		}
... ...
@@ -2001,8 +1966,7 @@ char * build_req_buf_from_sip_req( struct sip_msg* msg,
2001 2001
 	/* Calculate message body difference and adjust Content-Length */
2002 2002
 	body_delta = lumps_len(msg, msg->body_lumps, send_info);
2003 2003
 	if (adjust_clen(msg, body_delta, send_info->proto) < 0) {
2004
-		LOG(L_ERR, "ERROR: build_req_buf_from_sip_req: Error while adjusting"
2005
-				" Content-Length\n");
2004
+		LM_ERR("Error while adjusting Content-Length\n");
2006 2005
 		goto error00;
2007 2006
 	}
2008 2007
 
... ...
@@ -2026,8 +1990,7 @@ after_local_via:
2026 2026
 	/* check if received needs to be added */
2027 2027
 	if ( received_test(msg) ) {
2028 2028
 		if ((received_buf=received_builder(msg,&received_len))==0){
2029
-			LOG(L_ERR, "ERROR: build_req_buf_from_sip_req:"
2030
-							" received_builder failed\n");
2029
+			LM_ERR("received_builder failed\n");
2031 2030
 			goto error01;  /* free also line_buf */
2032 2031
 		}
2033 2032
 	}
... ...
@@ -2040,8 +2003,7 @@ after_local_via:
2040 2040
 	if ((flags&FL_FORCE_RPORT)||
2041 2041
 			(msg->via1->rport /*&& msg->via1->rport->value.s==0*/)){
2042 2042
 		if ((rport_buf=rport_builder(msg, &rport_len))==0){
2043
-			LOG(L_ERR, "ERROR: build_req_buf_from_sip_req:"
2044
-							" rport_builder failed\n");
2043
+			LM_ERR("rport_builder failed\n");
2045 2044
 			goto error01; /* free everything */
2046 2045
 		}
2047 2046
 	}
... ...
@@ -2102,7 +2064,7 @@ after_update_via1:
2102 2102
 		path_buf.len=ROUTE_PREFIX_LEN+msg->path_vec.len+CRLF_LEN;
2103 2103
 		path_buf.s=pkg_malloc(path_buf.len+1);
2104 2104
 		if (unlikely(path_buf.s==0)){
2105
-			LOG(L_ERR, "out of memory\n");
2105
+			LM_ERR("out of memory\n");
2106 2106
 			ser_error=E_OUT_OF_MEM;
2107 2107
 			goto error00;
2108 2108
 		}
... ...
@@ -2138,7 +2100,7 @@ after_update_via1:
2138 2138
 	/* compute new msg len and fix overlapping zones*/
2139 2139
 	new_len=len+body_delta+lumps_len(msg, msg->add_rm, send_info)+via_len;
2140 2140
 #ifdef XL_DEBUG
2141
-	LOG(L_ERR, "DEBUG: new_len(%d)=len(%d)+lumps_len\n", new_len, len);
2141
+	LM_ERR("new_len(%d)=len(%d)+lumps_len\n", new_len, len);
2142 2142
 #endif
2143 2143
 	udp_mtu=cfg_get(core, core_cfg, udp_mtu);
2144 2144
 	di.proto=PROTO_NONE;
... ...
@@ -2175,8 +2137,7 @@ after_update_via1:
2175 2175
 			if(likely(line_buf)) pkg_free(line_buf);
2176 2176
 			line_buf = create_via_hf( &via_len, msg, &di, &branch);
2177 2177
 			if (!line_buf){
2178
-				LOG(L_ERR,"ERROR: build_req_buf_from_sip_req: "
2179
-							"memory allocation failure!\n");
2178
+				LM_ERR("memory allocation failure!\n");
2180 2179
 				goto error00;
2181 2180
 			}
2182 2181
 			new_len+=via_len;
... ...
@@ -2200,7 +2161,7 @@ after_update_via1:
2200 2200
 		new_buf=(char*)pkg_malloc(new_len+1);
2201 2201
 	if (new_buf==0){
2202 2202
 		ser_error=E_OUT_OF_MEM;
2203
-		LOG(L_ERR, "ERROR: build_req_buf_from_sip_req: out of memory\n");
2203
+		LM_ERR("out of memory\n");
2204 2204
 		goto error00;
2205 2205
 	}
2206 2206
 
... ...
@@ -2232,7 +2193,7 @@ after_update_via1:
2232 2232
 
2233 2233
 #ifdef DBG_MSG_QA
2234 2234
 	if (new_buf[new_len-1]==0) {
2235
-		LOG(L_ERR, "ERROR: build_req_buf_from_sip_req: 0 in the end\n");
2235
+		LM_ERR("0 in the end\n");
2236 2236
 		abort();
2237 2237
 	}
2238 2238
 #endif
... ...
@@ -2287,14 +2248,14 @@ char * generate_res_buf_from_sip_res( struct sip_msg* msg,
2287 2287
 	body_delta = lumps_len(msg, msg->body_lumps, 0);
2288 2288
 	if (adjust_clen(msg, body_delta, (msg->via2? msg->via2->proto:PROTO_UDP))
2289 2289
 			< 0) {
2290
-		LOG(L_ERR, "error while adjusting Content-Length\n");
2290
+		LM_ERR("error while adjusting Content-Length\n");
2291 2291
 		goto error;
2292 2292
 	}
2293 2293
 
2294 2294
 	if(likely(!(mode&BUILD_NO_VIA1_UPDATE))) {
2295 2295
 		/* remove the first via*/
2296 2296
 		if (del_lump( msg, via_offset, via_len, HDR_VIA_T)==0){
2297
-			LOG(L_ERR, "error trying to remove first via\n");
2297
+			LM_ERR("error trying to remove first via\n");
2298 2298
 			goto error;
2299 2299
 		}
2300 2300
 	}
... ...
@@ -2306,7 +2267,7 @@ char * generate_res_buf_from_sip_res( struct sip_msg* msg,
2306 2306
 	new_buf=(char*)pkg_malloc(new_len+1); /* +1 is for debugging
2307 2307
 											 (\0 to print it )*/
2308 2308
 	if (new_buf==0){
2309
-		LOG(L_ERR, "out of mem\n");
2309
+		LM_ERR("out of mem\n");
2310 2310
 		goto error;
2311 2311
 	}
2312 2312
 	new_buf[new_len]=0; /* debug: print the message */
... ...
@@ -2369,8 +2330,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
2369 2369
 	end of header (non-block Vias are a really poor property
2370 2370
 	of SIP :( ) */
2371 2371
 	if (parse_headers( msg, HDR_EOH_F, 0 )==-1) {
2372
-		LOG(L_ERR, "ERROR: build_res_buf_from_sip_req: "
2373
-			"alas, parse_headers failed\n");
2372
+		LM_ERR("alas, parse_headers failed\n");
2374 2373
 		goto error00;
2375 2374
 	}
2376 2375
 
... ...
@@ -2380,8 +2340,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
2380 2380
 	/* check if received needs to be added */
2381 2381
 	if (received_test(msg)) {
2382 2382
 		if ((received_buf=received_builder(msg,&received_len))==0) {
2383
-			LOG(L_ERR, "ERROR: build_res_buf_from_sip_req: "
2384
-				"alas, received_builder failed\n");
2383
+			LM_ERR("alas, received_builder failed\n");
2385 2384
 			goto error00;
2386 2385
 		}
2387 2386
 	}
... ...
@@ -2389,8 +2348,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
2389 2389
 	if ( ((msg->msg_flags|global_req_flags)&FL_FORCE_RPORT)||
2390 2390
 		(msg->via1->rport /*&& msg->via1->rport->value.s==0*/)){
2391 2391
 		if ((rport_buf=rport_builder(msg, &rport_len))==0){
2392
-			LOG(L_ERR, "ERROR: build_res_buf_from_sip_req:"
2393
-							" rport_builder failed\n");
2392
+			LM_ERR("rport_builder failed\n");
2394 2393
 			goto error01; /* free everything */
2395 2394
 		}
2396 2395
 		if (msg->via1->rport)
... ...
@@ -2446,7 +2404,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
2446 2446
 	if (sip_warning) {
2447 2447
 		warning_buf = warning_builder(msg,&warning_len);
2448 2448
 		if (warning_buf) len += warning_len + CRLF_LEN;
2449
-		else LOG(L_WARN, "WARNING: warning skipped -- too big\n");
2449
+		else LM_WARN("warning skipped -- too big\n");
2450 2450
 	}
2451 2451
 	/* content length hdr */
2452 2452
 	if (body) {
... ...
@@ -2462,8 +2420,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
2462 2462
 	buf = (char*) pkg_malloc( len+1 );
2463 2463
 	if (!buf)
2464 2464
 	{
2465
-		LOG(L_ERR, "ERROR: build_res_buf_from_sip_req: out of memory "
2466
-			" ; needs %d\n",len);
2465
+		LM_ERR("out of memory; needs %d\n",len);
2467 2466
 		goto error01;
2468 2467
 	}
2469 2468
 
... ...
@@ -2610,8 +2567,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
2610 2610
 	}
2611 2611
 
2612 2612
 	if (len!=p-buf)
2613
-		LOG(L_CRIT,"BUG:build_res_from_sip_req: diff len=%d p-buf=%d\n",
2614
-					len, (int)(p-buf));
2613
+		LM_CRIT("diff len=%d p-buf=%d\n", len, (int)(p-buf));
2615 2614
 
2616 2615
 	*(p) = 0;
2617 2616
 	*returned_len = len;
... ...
@@ -2742,8 +2698,7 @@ char* via_builder( unsigned int *len,
2742 2742
 			comp_name=SERGZ_NAME;
2743 2743
 			break;
2744 2744
 		default:
2745
-			LOG(L_CRIT, "BUG: via_builder: unknown comp %d\n",
2746
-					send_info->comp);
2745
+			LM_CRIT("unknown comp %d\n", send_info->comp);
2747 2746
 			/* continue, we'll just ignore comp */
2748 2747
 	}
2749 2748
 #endif /* USE_COMP */
... ...
@@ -2759,7 +2714,7 @@ char* via_builder( unsigned int *len,
2759 2759
 	line_buf=pkg_malloc( max_len );
2760 2760
 	if (line_buf==0){
2761 2761
 		ser_error=E_OUT_OF_MEM;
2762
-		LOG(L_ERR, "ERROR: via_builder: out of memory\n");
2762
+		LM_ERR("out of memory\n");
2763 2763
 		return 0;
2764 2764
 	}
2765 2765
 
... ...
@@ -2792,8 +2747,7 @@ char* via_builder( unsigned int *len,
2792 2792
                 else if (likely(send_info->id))
2793 2793
                         con = tcpconn_get(send_info->id, 0, 0, 0, 0);
2794 2794
                 else {
2795
-                        LM_CRIT("BUG: via_builder called with null_id & to\n");
2796
-						pkg_free(line_buf);
2795
+                        LM_CRIT("null_id & to\n"); pkg_free(line_buf);
2797 2796
                         return 0;
2798 2797
                 }
2799 2798
 
... ...
@@ -2810,7 +2764,7 @@ char* via_builder( unsigned int *len,
2810 2810
 			memcpy(line_buf+MY_VIA_LEN-4, "WSS ", 4);
2811 2811
 		} else {
2812 2812
 			tcpconn_put(con);
2813
-			LOG(L_CRIT, "BUG: via_builder: unknown proto %d\n", con->rcv.proto);
2813
+			LM_CRIT("unknown proto %d\n", con->rcv.proto);
2814 2814
 			pkg_free(line_buf);
2815 2815
 			return 0;
2816 2816
 		}
... ...
@@ -2818,7 +2772,7 @@ char* via_builder( unsigned int *len,
2818 2818
 	}else if (send_info->proto==PROTO_WSS){
2819 2819
 		memcpy(line_buf+MY_VIA_LEN-4, "WSS ", 4);
2820 2820
 	}else{
2821
-		LOG(L_CRIT, "BUG: via_builder: unknown proto %d\n", send_info->proto);
2821
+		LM_CRIT("unknown proto %d\n", send_info->proto);
2822 2822
 		pkg_free(line_buf);
2823 2823
 		return 0;
2824 2824
 	}
... ...
@@ -2909,8 +2863,7 @@ char* create_via_hf( unsigned int *len,
2909 2909
 #endif /* USE_SCTP */
2910 2910
 			)){
2911 2911
 		if  ((id_buf=id_builder(msg, &id_len))==0){
2912
-			LOG(L_ERR, "ERROR: create_via_hf:"
2913
-							" id_builder failed\n");
2912
+			LM_ERR("id_builder failed\n");
2914 2913
 			return 0; /* we don't need to free anything,
2915 2914
 			                 nothing alloc'ed yet*/
2916 2915
 		}
... ...
@@ -2982,7 +2935,7 @@ char * build_only_headers( struct sip_msg* msg, int skip_first_line,
2982 2982
 
2983 2983
 	new_buf = (char *)pkg_malloc(new_len+1);
2984 2984
 	if (!new_buf) {
2985
-		LOG(L_ERR, "ERROR: build_only_headers: Not enough memory\n");
2985
+		LM_ERR("Not enough memory\n");
2986 2986
 		*error = -1;
2987 2987
 		return 0;
2988 2988
 	}
... ...
@@ -3032,7 +2985,7 @@ char * build_body( struct sip_msg* msg,
3032 3032
 
3033 3033
 	new_buf = (char *)pkg_malloc(new_len+1);
3034 3034
 	if (!new_buf) {
3035
-		LOG(L_ERR, "ERROR: build_body: Not enough memory\n");
3035
+		LM_ERR("Not enough memory\n");
3036 3036
 		*error = -1;
3037 3037
 		return 0;
3038 3038
 	}
... ...
@@ -3071,8 +3024,7 @@ char * build_all( struct sip_msg* msg, int touch_clen,
3071 3071
 	if (touch_clen) {
3072 3072
 		/* adjust Content-Length */
3073 3073
 		if (adjust_clen(msg, body_delta, send_info->proto) < 0) {
3074
-			LOG(L_ERR, "ERROR: build_all: Error while adjusting"
3075
-					" Content-Length\n");
3074
+			LM_ERR("Error while adjusting Content-Length\n");
3076 3075
 			*error = -1;
3077 3076
 			return 0;
3078 3077
 		}
... ...
@@ -3093,7 +3045,7 @@ char * build_all( struct sip_msg* msg, int touch_clen,
3093 3093
 
3094 3094
 	new_buf = (char *)pkg_malloc(new_len+1);
3095 3095
 	if (!new_buf) {
3096
-		LOG(L_ERR, "ERROR: build_all: Not enough memory\n");
3096
+		LM_ERR("Not enough memory\n");
3097 3097
 		*error = -1;
3098 3098
 		return 0;
3099 3099
 	}