Browse code

route.c: logging: convert LOG to LM_*

Ovidiu Sas authored on 04/10/2014 01:24:54
Showing 1 changed files
... ...
@@ -158,7 +158,7 @@ static int route_add(struct route_list* rt, char* name, int i)
158 158
 	
159 159
 	e=pkg_malloc(sizeof(struct str_hash_entry));
160 160
 	if (e==0){
161
-		LOG(L_CRIT, "ERROR: route_add: out of memory\n");
161
+		LM_CRIT("out of memory\n");
162 162
 		goto error;
163 163
 	}
164 164
 	LM_DBG("mapping routing block (%p)[%s] to %d\n", rt, name, i);
... ...
@@ -180,7 +180,7 @@ inline  static int init_rlist(char* r_name, struct route_list* rt,
180 180
 {
181 181
 		rt->rlist=pkg_malloc(sizeof(struct action*)*n_entries);
182 182
 		if (rt->rlist==0){ 
183
-			LOG(L_CRIT, "ERROR: failed to allocate \"%s\" route tables: " 
183
+			LM_CRIT("failed to allocate \"%s\" route tables: " 
184 184
 					"out of memory\n", r_name); 
185 185
 			goto error; 
186 186
 		}
... ...
@@ -188,7 +188,7 @@ inline  static int init_rlist(char* r_name, struct route_list* rt,
188 188
 		rt->idx=1; /* idx=0 == default == reserved */
189 189
 		rt->entries=n_entries;
190 190
 		if (str_hash_alloc(&rt->names, hash_size)<0){
191
-			LOG(L_CRIT, "ERROR: \"%s\" route table: failed to alloc hash\n",
191
+			LM_CRIT("\"%s\" route table: failed to alloc hash\n",
192 192
 					r_name);
193 193
 			goto error;
194 194
 		}
... ...
@@ -234,7 +234,7 @@ static inline int route_new_list(struct route_list* rt)
234 234
 	if (rt->idx >= rt->entries){
235 235
 		tmp=pkg_realloc(rt->rlist, 2*rt->entries*sizeof(struct action*));
236 236
 		if (tmp==0){
237
-			LOG(L_CRIT, "ERROR: route_new_list: out of memory\n");
237
+			LM_CRIT("out of memory\n");
238 238
 			goto end;
239 239
 		}
240 240
 		/* init the newly allocated memory chunk */
... ...
@@ -520,7 +520,7 @@ int fix_expr(struct expr* exp)
520 520
 
521 521
 	ret=E_BUG;
522 522
 	if (exp==0){
523
-		LOG(L_CRIT, "BUG: fix_expr: null pointer\n");
523
+		LM_CRIT("null pointer\n");
524 524
 		return E_BUG;
525 525
 	}
526 526
 	if (exp->type==EXP_T){
... ...
@@ -535,8 +535,7 @@ int fix_expr(struct expr* exp)
535 535
 						ret=fix_expr(exp->l.expr);
536 536
 						break;
537 537
 			default:
538
-						LOG(L_CRIT, "BUG: fix_expr: unknown op %d\n",
539
-								exp->op);
538
+						LM_CRIT("unknown op %d\n", exp->op);
540 539
 		}
541 540
 	}else if (exp->type==ELEM_T){
542 541
 			/* first calculate lengths of strings  (only right side, since 
... ...
@@ -552,7 +551,7 @@ int fix_expr(struct expr* exp)
552 551
 			   before MATCH_OP and other fixups) */
553 552
 			if (exp->l_type==RVEXP_O){
554 553
 				if ((ret=fix_rval_expr(exp->l.param))<0){
555
-					ERR("Unable to fix left rval expression\n");
554
+					LM_ERR("Unable to fix left rval expression\n");
556 555
 					return ret;
557 556
 				}
558 557
 				if (scr_opt_lev>=2)
... ...
@@ -560,7 +559,7 @@ int fix_expr(struct expr* exp)
560 559
 			}
561 560
 			if (exp->r_type==RVE_ST){
562 561
 				if ((ret=fix_rval_expr(exp->r.param))<0){
563
-					ERR("Unable to fix right rval expression\n");
562
+					LM_ERR("Unable to fix right rval expression\n");
564 563
 					return ret;
565 564
 				}
566 565
 				if (scr_opt_lev>=2)
... ...
@@ -576,14 +575,12 @@ int fix_expr(struct expr* exp)
576 575
 				if (exp->r_type==STRING_ST){
577 576
 					re=(regex_t*)pkg_malloc(sizeof(regex_t));
578 577
 					if (re==0){
579
-						LOG(L_CRIT, "ERROR: fix_expr: memory allocation"
580
-								" failure\n");
578
+						LM_CRIT("memory allocation failure\n");
581 579
 						return E_OUT_OF_MEM;
582 580
 					}
583 581
 					if (regcomp(re, (char*) exp->r.param,
584 582
 								REG_EXTENDED|REG_NOSUB|REG_ICASE) ){
585
-						LOG(L_CRIT, "ERROR: fix_expr : bad re \"%s\"\n",
586
-									(char*) exp->r.param);
583
+						LM_CRIT("bad re \"%s\"\n", (char*) exp->r.param);
587 584
 						pkg_free(re);
588 585
 						return E_BAD_RE;
589 586
 					}
... ...
@@ -596,20 +593,20 @@ int fix_expr(struct expr* exp)
596 593
 						exp->r_type != SELECT_UNFIXED_ST &&
597 594
 						exp->r_type!= RVE_ST
598 595
 						&& exp->r_type != PVAR_ST){
599
-					LOG(L_CRIT, "BUG: fix_expr : invalid type for match\n");
596
+					LM_CRIT("invalid type for match\n");
600 597
 					return E_BUG;
601 598
 				}
602 599
 			}
603 600
 			if (exp->l_type==ACTION_O){
604 601
 				ret=fix_actions((struct action*)exp->r.param);
605 602
 				if (ret!=0){
606
-					LOG(L_CRIT, "ERROR: fix_expr : fix_actions error\n");
603
+					LM_CRIT("fix_actions error\n");
607 604
 					return ret;
608 605
 				}
609 606
 			}
610 607
 			if (exp->l_type==SELECT_UNFIXED_O) {
611 608
 				if ((ret=resolve_select(exp->l.select)) < 0) {
612
-					ERR("Unable to resolve select\n");
609
+					LM_ERR("Unable to resolve select\n");
613 610
 					print_select(exp->l.select);
614 611
 					return ret;
615 612
 				}
... ...
@@ -617,7 +614,7 @@ int fix_expr(struct expr* exp)
617 614
 			}
618 615
 			if (exp->r_type==SELECT_UNFIXED_ST) {
619 616
 				if ((ret=resolve_select(exp->r.select)) < 0) {
620
-					ERR("Unable to resolve select\n");
617
+					LM_ERR("Unable to resolve select\n");
621 618
 					print_select(exp->r.select);
622 619
 					return ret;
623 620
 				}
... ...
@@ -654,7 +651,7 @@ int fix_actions(struct action* a)
654 651
 	int rve_param_no;
655 652
 
656 653
 	if (a==0){
657
-		LOG(L_CRIT,"BUG: fix_actions: null pointer\n");
654
+		LM_CRIT("null pointer\n");
658 655
 		return E_BUG;
659 656
 	}
660 657
 	for(t=a; t!=0; t=t->next){
... ...
@@ -669,8 +666,7 @@ int fix_actions(struct action* a)
669 666
 							tmp=strdup(ip_addr2a(
670 667
 										(struct ip_addr*)t->val[0].u.data));
671 668
 							if (tmp==0){
672
-								LOG(L_CRIT, "ERROR: fix_actions:"
673
-										"memory allocation failure\n");
669
+								LM_CRIT("memory allocation failure\n");
674 670
 								ret = E_OUT_OF_MEM;
675 671
 								goto error;
676 672
 							}
... ...
@@ -688,8 +684,7 @@ int fix_actions(struct action* a)
688 684
 						case URIHOST_ST:
689 685
 							break;
690 686
 						default:
691
-							LOG(L_CRIT, "BUG: fix_actions: invalid type"
692
-									"%d (should be string or number)\n",
687
+							LM_CRIT("invalid type %d (should be string or number)\n",
693 688
 										t->type);
694 689
 							ret = E_BUG;
695 690
 							goto error;
... ...
@@ -697,22 +692,19 @@ int fix_actions(struct action* a)
697 692
 					break;
698 693
 			case IF_T:
699 694
 				if (t->val[0].type!=RVE_ST){
700
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
701
-								"%d for if (should be rval expr)\n",
695
+					LM_CRIT("invalid subtype %d for if (should be rval expr)\n",
702 696
 								t->val[0].type);
703 697
 					ret = E_BUG;
704 698
 					goto error;
705 699
 				}else if( (t->val[1].type!=ACTIONS_ST) &&
706 700
 							(t->val[1].type!=NOSUBTYPE) ){
707
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
708
-								"%d for if() {...} (should be action)\n",
701
+					LM_CRIT("invalid subtype %d for if() {...} (should be action)\n",
709 702
 								t->val[1].type);
710 703
 					ret = E_BUG;
711 704
 					goto error;
712 705
 				}else if( (t->val[2].type!=ACTIONS_ST) &&
713 706
 							(t->val[2].type!=NOSUBTYPE) ){
714
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
715
-								"%d for if() {} else{...}(should be action)\n",
707
+					LM_CRIT("invalid subtype %d for if() {} else{...}(should be action)\n",
716 708
 								t->val[2].type);
717 709
 					ret = E_BUG;
718 710
 					goto error;
... ...
@@ -723,7 +715,7 @@ int fix_actions(struct action* a)
723 715
 					if (!rve_check_type(&rve_type, rve, &err_rve,
724 716
 											&err_type, &expected_type)){
725 717
 						if (err_rve)
726
-							LOG(L_ERR, "fix_actions: invalid expression "
718
+							LM_ERR("invalid expression "
727 719
 									"(%d,%d): subexpression (%d,%d) has type"
728 720
 									" %s,  but %s is expected\n",
729 721
 									rve->fpos.s_line, rve->fpos.s_col,
... ...
@@ -731,8 +723,7 @@ int fix_actions(struct action* a)
731 723
 									rval_type_name(err_type),
732 724
 									rval_type_name(expected_type) );
733 725
 						else
734
-							LOG(L_ERR, "fix_actions: invalid expression "
735
-									"(%d,%d): type mismatch?",
726
+							LM_ERR("invalid expression  (%d,%d): type mismatch?",
736 727
 									rve->fpos.s_line, rve->fpos.s_col);
737 728
 						ret = E_SCRIPT;
738 729
 						goto error;
... ...
@@ -741,7 +732,7 @@ int fix_actions(struct action* a)
741 732
 					   only a script warning (to allow backward compat. stuff
742 733
 					   like if (@ruri) 
743 734
 					if (rve_type!=RV_INT && rve_type!=RV_NONE){
744
-						LOG(L_ERR, "fix_actions: invalid expression (%d,%d):"
735
+						LM_ERR("fix_actions: invalid expression (%d,%d):"
745 736
 								" bad type, integer expected\n",
746 737
 								rve->fpos.s_line, rve->fpos.s_col);
747 738
 						return E_UNSPEC;
... ...
@@ -762,14 +753,12 @@ int fix_actions(struct action* a)
762 753
 				break;
763 754
 			case SWITCH_T:
764 755
 				if (t->val[0].type!=RVE_ST){
765
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
766
-								"%d for switch() (should be expr)\n",
756
+					LM_CRIT("invalid subtype %d for switch() (should be expr)\n",
767 757
 								t->val[0].type);
768 758
 					ret = E_BUG;
769 759
 					goto error;
770 760
 				}else if (t->val[1].type!=CASE_ST){
771
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
772
-								"%d for switch(...){...}(should be case)\n",
761
+					LM_CRIT("invalid subtype %d for switch(...){...}(should be case)\n",
773 762
 								t->val[1].type);
774 763
 					ret = E_BUG;
775 764
 					goto error;
... ...
@@ -778,8 +767,7 @@ int fix_actions(struct action* a)
778 767
 					if ((ret=fix_rval_expr(t->val[0].u.data))<0)
779 768
 						goto error;
780 769
 				}else{
781
-					LOG(L_CRIT, "BUG: fix_actions: null switch()"
782
-							" expression\n");
770
+					LM_CRIT("null switch() expression\n");
783 771
 					ret = E_BUG;
784 772
 					goto error;
785 773
 				}
... ...
@@ -788,14 +776,12 @@ int fix_actions(struct action* a)
788 776
 				break;
789 777
 			case WHILE_T:
790 778
 				if (t->val[0].type!=RVE_ST){
791
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
792
-								"%d for while() (should be expr)\n",
779
+					LM_CRIT("invalid subtype %d for while() (should be expr)\n",
793 780
 								t->val[0].type);
794 781
 					ret = E_BUG;
795 782
 					goto error;
796 783
 				}else if (t->val[1].type!=ACTIONS_ST){
797
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
798
-								"%d for while(...){...}(should be action)\n",
784
+					LM_CRIT("invalid subtype %d for while(...){...}(should be action)\n",
799 785
 								t->val[1].type);
800 786
 					ret = E_BUG;
801 787
 					goto error;
... ...
@@ -806,7 +792,7 @@ int fix_actions(struct action* a)
806 792
 					if (!rve_check_type(&rve_type, rve, &err_rve,
807 793
 											&err_type, &expected_type)){
808 794
 						if (err_rve)
809
-							LOG(L_ERR, "fix_actions: invalid expression "
795
+							LM_ERR("invalid expression "
810 796
 									"(%d,%d): subexpression (%d,%d) has type"
811 797
 									" %s,  but %s is expected\n",
812 798
 									rve->fpos.s_line, rve->fpos.s_col,
... ...
@@ -814,15 +800,13 @@ int fix_actions(struct action* a)
814 800
 									rval_type_name(err_type),
815 801
 									rval_type_name(expected_type) );
816 802
 						else
817
-							LOG(L_ERR, "fix_actions: invalid expression "
818
-									"(%d,%d): type mismatch?",
803
+							LM_ERR("invalid expression (%d,%d): type mismatch?",
819 804
 									rve->fpos.s_line, rve->fpos.s_col);
820 805
 						ret = E_SCRIPT;
821 806
 						goto error;
822 807
 					}
823 808
 					if (rve_type!=RV_INT && rve_type!=RV_NONE){
824
-						LOG(L_ERR, "fix_actions: invalid expression (%d,%d):"
825
-								" bad type, integer expected\n",
809
+						LM_ERR("invalid expression (%d,%d): bad type, integer expected\n",
826 810
 								rve->fpos.s_line, rve->fpos.s_col);
827 811
 						ret = E_SCRIPT;
828 812
 						goto error;
... ...
@@ -830,8 +814,7 @@ int fix_actions(struct action* a)
830 814
 					if ((ret=fix_rval_expr(t->val[0].u.data))<0)
831 815
 						goto error;
832 816
 				}else{
833
-					LOG(L_CRIT, "BUG: fix_actions: null while()"
834
-							" expression\n");
817
+					LM_CRIT("null while() expression\n");
835 818
 					ret = E_BUG;
836 819
 					goto error;
837 820
 				}
... ...
@@ -850,7 +833,7 @@ int fix_actions(struct action* a)
850 833
 					if (!rve_check_type(&rve_type, rve, &err_rve,
851 834
 											&err_type, &expected_type)){
852 835
 						if (err_rve)
853
-							LOG(L_ERR, "fix_actions: invalid expression "
836
+							LM_ERR("invalid expression "
854 837
 									"(%d,%d): subexpression (%d,%d) has type"
855 838
 									" %s,  but %s is expected\n",
856 839
 									rve->fpos.s_line, rve->fpos.s_col,
... ...
@@ -858,15 +841,13 @@ int fix_actions(struct action* a)
858 841
 									rval_type_name(err_type),
859 842
 									rval_type_name(expected_type) );
860 843
 						else
861
-							LOG(L_ERR, "fix_actions: invalid expression "
862
-									"(%d,%d): type mismatch?",
844
+							LM_ERR("invalid expression (%d,%d): type mismatch?",
863 845
 									rve->fpos.s_line, rve->fpos.s_col);
864 846
 						ret = E_SCRIPT;
865 847
 						goto error;
866 848
 					}
867 849
 					if (rve_type!=RV_INT && rve_type!=RV_NONE){
868
-						LOG(L_ERR, "fix_actions: invalid expression (%d,%d):"
869
-								" bad type, integer expected\n",
850
+						LM_ERR("invalid expression (%d,%d): bad type, integer expected\n",
870 851
 								rve->fpos.s_line, rve->fpos.s_col);
871 852
 						ret = E_SCRIPT;
872 853
 						goto error;
... ...
@@ -874,8 +855,7 @@ int fix_actions(struct action* a)
874 855
 					if ((ret=fix_rval_expr(t->val[0].u.data))<0)
875 856
 						goto error;
876 857
 				}else{
877
-					LOG(L_CRIT, "BUG: fix_actions: null drop/return"
878
-							" expression\n");
858
+					LM_CRIT("null drop/return expression\n");
879 859
 					ret = E_BUG;
880 860
 					goto error;
881 861
 				}
... ...
@@ -883,27 +863,26 @@ int fix_actions(struct action* a)
883 863
 			case ASSIGN_T:
884 864
 			case ADD_T:
885 865
 				if (t->val[0].type !=LVAL_ST) {
886
-					LOG(L_CRIT, "BUG: fix_actions: Invalid left side of"
887
-								" assignment\n");
866
+					LM_CRIT("Invalid left side of assignment\n");
888 867
 					ret = E_BUG;
889 868
 					goto error;
890 869
 				}
891 870
 				if (t->val[1].type !=RVE_ST) {
892
-					LOG(L_CRIT, "BUG: fix_actions: Invalid right side of"
893
-								" assignment (%d)\n", t->val[1].type);
871
+					LM_CRIT("Invalid right side of assignment (%d)\n",
872
+								t->val[1].type);
894 873
 					ret = E_BUG;
895 874
 					goto error;
896 875
 				}
897 876
 				lval=t->val[0].u.data;
898 877
 				if (lval->type==LV_AVP){
899 878
 					if (lval->lv.avps.type & AVP_CLASS_DOMAIN) {
900
-						LOG(L_ERR, "ERROR: You cannot change domain"
879
+						LM_ERR("You cannot change domain"
901 880
 									" attributes from the script, they are"
902 881
 									" read-only\n");
903 882
 						ret = E_BUG;
904 883
 						goto error;
905 884
 					} else if (lval->lv.avps.type & AVP_CLASS_GLOBAL) {
906
-						LOG(L_ERR, "ERROR: You cannot change global"
885
+						LM_ERR("You cannot change global"
907 886
 								   " attributes from the script, they are"
908 887
 								   "read-only\n");
909 888
 						ret = E_BUG;
... ...
@@ -1031,8 +1010,7 @@ int fix_actions(struct action* a)
1031 1010
 				break;
1032 1011
 			case FORCE_SEND_SOCKET_T:
1033 1012
 				if (t->val[0].type!=SOCKID_ST){
1034
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
1035
-								"%d for force_send_socket\n",
1013
+					LM_CRIT("invalid subtype %d for force_send_socket\n",
1036 1014
 								t->val[0].type);
1037 1015
 					ret = E_BUG;
1038 1016
 					goto error;
... ...
@@ -1041,8 +1019,7 @@ int fix_actions(struct action* a)
1041 1019
 						((struct socket_id*)t->val[0].u.data)->addr_lst->name
1042 1020
 						);
1043 1021
 				if (he==0){
1044
-					LOG(L_ERR, "ERROR: fix_actions: force_send_socket:"
1045
-								" could not resolve %s\n",
1022
+					LM_ERR("force_send_socket: could not resolve %s\n",
1046 1023
 						((struct socket_id*)t->val[0].u.data)->addr_lst->name);
1047 1024
 					ret = E_BAD_ADDRESS;
1048 1025
 					goto error;
... ...
@@ -1051,8 +1028,7 @@ int fix_actions(struct action* a)
1051 1028
 				si=find_si(&ip, ((struct socket_id*)t->val[0].u.data)->port,
1052 1029
 								((struct socket_id*)t->val[0].u.data)->proto);
1053 1030
 				if (si==0){
1054
-					LOG(L_ERR, "ERROR: fix_actions: bad force_send_socket"
1055
-							" argument: %s:%d (ser doesn't listen on it)\n",
1031
+					LM_ERR("bad force_send_socket argument: %s:%d (ser doesn't listen on it)\n",
1056 1032
 						((struct socket_id*)t->val[0].u.data)->addr_lst->name,
1057 1033
 							((struct socket_id*)t->val[0].u.data)->port);
1058 1034
 					ret = E_BAD_ADDRESS;
... ...
@@ -1063,8 +1039,7 @@ int fix_actions(struct action* a)
1063 1039
 				break;
1064 1040
 			case UDP_MTU_TRY_PROTO_T:
1065 1041
 				if (t->val[0].type!=NUMBER_ST){
1066
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
1067
-								"%d for udp_mtu_try_proto\n",
1042
+					LM_CRIT("invalid subtype %d for udp_mtu_try_proto\n",
1068 1043
 								t->val[0].type);
1069 1044
 					ret = E_BUG;
1070 1045
 					goto error;
... ...
@@ -1083,8 +1058,7 @@ int fix_actions(struct action* a)
1083 1058
 						t->val[0].u.number=FL_MTU_SCTP_FB;
1084 1059
 						break;
1085 1060
 					default:
1086
-						LOG(L_CRIT, "BUG: fix actions: invalid argument for"
1087
-									" udp_mtu_try_proto (%d)\n", 
1061
+						LM_CRIT("invalid argument for udp_mtu_try_proto (%d)\n", 
1088 1062
 									(unsigned int)t->val[0].u.number);
1089 1063
 				}
1090 1064
 				break;
... ...
@@ -1105,7 +1079,7 @@ int fix_actions(struct action* a)
1105 1079
 					rve=(struct rval_expr*)t->val[0].u.data;
1106 1080
 					if (!rve_is_constant(rve)) {
1107 1081
 						if ((ret=fix_rval_expr(t->val[0].u.data)) < 0){
1108
-							ERR("route() failed to fix rve at %s:%d\n",
1082
+							LM_ERR("route() failed to fix rve at %s:%d\n",
1109 1083
 								(t->cfile)?t->cfile:"line", t->cline);
1110 1084
 							ret = E_BUG;
1111 1085
 							goto error;
... ...
@@ -1116,7 +1090,7 @@ int fix_actions(struct action* a)
1116 1090
 								rval_get_str(0, 0, &s, rv, 0) < 0) {
1117 1091
 							/* out of mem. or bug ? */
1118 1092
 							rval_destroy(rv);
1119
-							ERR("route() failed to fix ct. rve at %s:%d\n",
1093
+							LM_ERR("route() failed to fix ct. rve at %s:%d\n",
1120 1094
 								(t->cfile)?t->cfile:"line", t->cline);
1121 1095
 							ret = E_BUG;
1122 1096
 							goto error;
... ...
@@ -1132,7 +1106,7 @@ int fix_actions(struct action* a)
1132 1106
 				if (t->val[0].type == STRING_ST) {
1133 1107
 					i=route_lookup(&main_rt, t->val[0].u.string);
1134 1108
 					if (i < 0) {
1135
-						ERR("route \"%s\" not found at %s:%d\n",
1109
+						LM_ERR("route \"%s\" not found at %s:%d\n",
1136 1110
 								t->val[0].u.string,
1137 1111
 								(t->cfile)?t->cfile:"line", t->cline);
1138 1112
 						ret = E_SCRIPT;
... ...
@@ -1159,7 +1133,7 @@ int fix_actions(struct action* a)
1159 1133
 						rv = rval_expr_eval(0, 0, rve);
1160 1134
 						if (rv == 0 ||
1161 1135
 								rval_get_int( 0, 0, &i, rv, 0) < 0 ) {
1162
-							ERR("failed to fix constant rve");
1136
+							LM_ERR("failed to fix constant rve");
1163 1137
 							if (rv) rval_destroy(rv);
1164 1138
 							ret = E_BUG;
1165 1139
 							goto error;
... ...
@@ -1173,7 +1147,7 @@ int fix_actions(struct action* a)
1173 1147
 						   optimize it */
1174 1148
 						if ((ret=fix_rval_expr(rve))
1175 1149
 								< 0) {
1176
-							ERR("rve fixup failed\n");
1150
+							LM_ERR("rve fixup failed\n");
1177 1151
 							ret = E_BUG;
1178 1152
 							goto error;
1179 1153
 						}
... ...
@@ -1194,7 +1168,7 @@ int fix_actions(struct action* a)
1194 1168
 				}
1195 1169
 				tmp_p = (void *)cfg_lookup_group(t->val[0].u.string, strlen(t->val[0].u.string));
1196 1170
 				if (!tmp_p) {
1197
-					ERR("configuration group \"%s\" not found\n",
1171
+					LM_ERR("configuration group \"%s\" not found\n",
1198 1172
 						t->val[0].u.string);
1199 1173
 					ret = E_SCRIPT;
1200 1174
 					goto error;
... ...
@@ -1260,7 +1234,7 @@ inline static int comp_num(int op, long left, int rtype, union exp_op* r,
1260 1234
 			}
1261 1235
 			break;
1262 1236
 		default:
1263
-			LOG(L_CRIT, "BUG: comp_num: Invalid right operand (%d)\n", rtype);
1237
+			LM_CRIT("Invalid right operand (%d)\n", rtype);
1264 1238
 			return E_BUG;
1265 1239
 	}
1266 1240
 
... ...
@@ -1272,7 +1246,7 @@ inline static int comp_num(int op, long left, int rtype, union exp_op* r,
1272 1246
 		case GTE_OP:   return (long)left >= (long)right;
1273 1247
 		case LTE_OP:   return (long)left <= (long)right;
1274 1248
 		default:
1275
-			LOG(L_CRIT, "BUG: comp_num: unknown operator: %d\n", op);
1249
+			LM_CRIT("unknown operator: %d\n", op);
1276 1250
 			return E_BUG;
1277 1251
 	}
1278 1252
 	return E_BUG;
... ...
@@ -1340,8 +1314,7 @@ inline static int comp_str(int op, str* left, int rtype,
1340 1314
 			break;
1341 1315
 		case RE_ST:
1342 1316
 			if (unlikely(op != MATCH_OP)){
1343
-				LOG(L_CRIT, "BUG: comp_str: Bad operator %d,"
1344
-							" ~= expected\n", op);
1317
+				LM_CRIT("Bad operator %d, ~= expected\n", op);
1345 1318
 				goto error;
1346 1319
 			}
1347 1320
 			break;
... ...
@@ -1359,8 +1332,7 @@ inline static int comp_str(int op, str* left, int rtype,
1359 1332
 				goto error;
1360 1333
 			return comp_num(op, l, rtype, r, msg, h);
1361 1334
 		default:
1362
-			LOG(L_CRIT, "BUG: comp_str: Bad type %d, "
1363
-						"string or RE expected\n", rtype);
1335
+			LM_CRIT("Bad type %d, string or RE expected\n", rtype);
1364 1336
 			goto error;
1365 1337
 	}
1366 1338
 
... ...
@@ -1404,8 +1376,7 @@ inline static int comp_str(int op, str* left, int rtype,
1404 1376
 					/* we need to compile the RE on the fly */
1405 1377
 					re=(regex_t*)pkg_malloc(sizeof(regex_t));
1406 1378
 					if (re==0){
1407
-						LOG(L_CRIT, "ERROR: comp_strstr: memory allocation"
1408
-									 " failure\n");
1379
+						LM_CRIT("memory allocation failure\n");
1409 1380
 						left->s[left->len] = backup;
1410 1381
 						goto error;
1411 1382
 					}
... ...
@@ -1423,14 +1394,13 @@ inline static int comp_str(int op, str* left, int rtype,
1423 1394
 					ret=(regexec(r->re, left->s, 0, 0, 0)==0);
1424 1395
 					break;
1425 1396
 				default:
1426
-					LOG(L_CRIT, "BUG: comp_str: Bad operator type %d, "
1427
-								"for ~= \n", rtype);
1397
+					LM_CRIT("Bad operator type %d, for ~= \n", rtype);
1428 1398
 					goto error;
1429 1399
 			}
1430 1400
 			left->s[left->len] = backup;
1431 1401
 			break;
1432 1402
 		default:
1433
-			LOG(L_CRIT, "BUG: comp_str: unknown op %d\n", op);
1403
+			LM_CRIT("unknown op %d\n", op);
1434 1404
 			goto error;
1435 1405
 	}
1436 1406
 	if (rv){
... ...
@@ -1503,8 +1473,7 @@ inline static int comp_avp(int op, avp_spec_t* spec, int rtype,
1503 1473
 				tmp.s=r->string;
1504 1474
 				tmp.len=strlen(r->string);
1505 1475
 				if (str2int(&tmp, &uval)<0){
1506
-					LOG(L_WARN, "WARNING: comp_avp: cannot convert"
1507
-								" string value to int (%s)\n",
1476
+					LM_WARN("cannot convert string value to int (%s)\n",
1508 1477
 								ZSW(r->string));
1509 1478
 					goto error;
1510 1479
 				}
... ...
@@ -1512,15 +1481,15 @@ inline static int comp_avp(int op, avp_spec_t* spec, int rtype,
1512 1481
 				return comp_num(op, val.n, NUMBER_ST, &num_val, msg, h);
1513 1482
 			case STR_ST:
1514 1483
 				if (str2int(&r->str, &uval)<0){
1515
-					LOG(L_WARN, "WARNING: comp_avp: cannot convert str value"
1516
-								" to int (%.*s)\n", r->str.len, ZSW(r->str.s));
1484
+					LM_WARN("cannot convert str value to int (%.*s)\n",
1485
+								r->str.len, ZSW(r->str.s));
1517 1486
 					goto error;
1518 1487
 				}
1519 1488
 				num_val.numval=uval;
1520 1489
 				return comp_num(op, val.n, NUMBER_ST, &num_val, msg, h);
1521 1490
 			default:
1522
-				LOG(L_CRIT, "BUG: comp_avp: invalid type for numeric avp "
1523
-							"comparison (%d)\n", rtype);
1491
+				LM_CRIT("invalid type for numeric avp comparison (%d)\n",
1492
+								rtype);
1524 1493
 				goto error;
1525 1494
 		}
1526 1495
 	}
... ...
@@ -1564,7 +1533,7 @@ inline static int comp_rve(int op, struct rval_expr* rve, int rtype,
1564 1533
 	
1565 1534
 	rval_cache_init(&c1);
1566 1535
 	if (unlikely(rval_expr_eval_rvint(h,  msg, &rv, &i, rve, &c1)<0)){
1567
-		ERR("failure evaluating expression: bad type\n");
1536
+		LM_ERR("failure evaluating expression: bad type\n");
1568 1537
 		i=0; /* false */
1569 1538
 		goto int_expr;
1570 1539
 	}
... ...
@@ -1635,7 +1604,7 @@ inline static int check_self_op(int op, str* s, unsigned short p)
1635 1604
 			ret=(ret > 0) ? 0 : 1;
1636 1605
 			break;
1637 1606
 		default:
1638
-			LOG(L_CRIT, "BUG: check_self_op: invalid operator %d\n", op);
1607
+			LM_CRIT("invalid operator %d\n", op);
1639 1608
 			ret=-1;
1640 1609
 	}
1641 1610
 	return ret;
... ...
@@ -1751,8 +1720,7 @@ inline static int comp_ip(int op, struct ip_addr* ip, int rtype,
1751 1720
 			}
1752 1721
 			return ret;
1753 1722
 		default:
1754
-			LOG(L_CRIT, "BUG: comp_ip: invalid type for "
1755
-						" src_ip or dst_ip (%d)\n", rtype);
1723
+			LM_CRIT("invalid type for src_ip or dst_ip (%d)\n", rtype);
1756 1724
 			return -1;
1757 1725
 	}
1758 1726
 	/* here "right" is set to the str we compare with */
... ...
@@ -1838,7 +1806,7 @@ inline static int comp_ip(int op, struct ip_addr* ip, int rtype,
1838 1806
 		pv_value_destroy(&pval);
1839 1807
 	return ret;
1840 1808
 error_op:
1841
-	LOG(L_CRIT, "BUG: comp_ip: invalid operator %d for type %d\n", op, rtype);
1809
+	LM_CRIT("invalid operator %d for type %d\n", op, rtype);
1842 1810
 error:
1843 1811
 	if (unlikely(rv)){
1844 1812
 		rval_cache_clean(&rv_cache);
... ...
@@ -1862,7 +1830,7 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
1862 1830
 	ret=E_BUG;
1863 1831
 
1864 1832
 	if (e->type!=ELEM_T){
1865
-		LOG(L_CRIT," BUG: eval_elem: invalid type\n");
1833
+		LM_CRIT("invalid type\n");
1866 1834
 		goto error;
1867 1835
 	}
1868 1836
 	switch(e->l_type){
... ...
@@ -1905,14 +1873,13 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
1905 1873
 
1906 1874
 	case FROM_URI_O:
1907 1875
 		if (parse_from_header(msg)!=0){
1908
-			LOG(L_ERR, "ERROR: eval_elem: bad or missing"
1909
-			    " From: header\n");
1876
+			LM_ERR("bad or missing From: header\n");
1910 1877
 			goto error;
1911 1878
 		}
1912 1879
 		if (e->r_type==MYSELF_ST){
1913 1880
 			if (parse_uri(get_from(msg)->uri.s, get_from(msg)->uri.len,
1914 1881
 				      &uri) < 0){
1915
-				LOG(L_ERR, "ERROR: eval_elem: bad uri in From:\n");
1882
+				LM_ERR("bad uri in From:\n");
1916 1883
 				goto error;
1917 1884
 			}
1918 1885
 			ret=check_self_op(e->op, &uri.host, GET_URI_PORT(&uri));
... ...
@@ -1925,15 +1892,14 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
1925 1892
 	case TO_URI_O:
1926 1893
 		if ((msg->to==0) && ((parse_headers(msg, HDR_TO_F, 0)==-1) ||
1927 1894
 				     (msg->to==0))){
1928
-			LOG(L_ERR, "ERROR: eval_elem: bad or missing"
1929
-			    " To: header\n");
1895
+			LM_ERR("bad or missing To: header\n");
1930 1896
 			goto error;
1931 1897
 		}
1932 1898
 		     /* to content is parsed automatically */
1933 1899
 		if (e->r_type==MYSELF_ST){
1934 1900
 			if (parse_uri(get_to(msg)->uri.s, get_to(msg)->uri.len,
1935 1901
 				      &uri) < 0){
1936
-				LOG(L_ERR, "ERROR: eval_elem: bad uri in To:\n");
1902
+				LM_ERR("bad uri in To:\n");
1937 1903
 				goto error;
1938 1904
 			}
1939 1905
 			ret=check_self_op(e->op, &uri.host, GET_URI_PORT(&uri));
... ...
@@ -2070,8 +2036,7 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
2070 2036
 		break;
2071 2037
 /*
2072 2038
 	default:
2073
-		LOG(L_CRIT, "BUG: eval_elem: invalid operand %d\n",
2074
-		    e->l_type);
2039
+		LM_CRIT("invalid operand %d\n", e->l_type);
2075 2040
 */
2076 2041
 	}
2077 2042
 	return ret;
... ...
@@ -2107,11 +2072,11 @@ int eval_expr(struct run_act_ctx* h, struct expr* e, struct sip_msg* msg)
2107 2072
 				ret=(ret > 0) ? 0 : 1;
2108 2073
 				break;
2109 2074
 			default:
2110
-				LOG(L_CRIT, "BUG: eval_expr: unknown op %d\n", e->op);
2075
+				LM_CRIT("unknown op %d\n", e->op);
2111 2076
 				ret=-1;
2112 2077
 		}
2113 2078
 	}else{
2114
-		LOG(L_CRIT, "BUG: eval_expr: unknown type %d\n", e->type);
2079
+		LM_CRIT("unknown type %d\n", e->type);
2115 2080
 		ret=-1;
2116 2081
 	}
2117 2082
 	return ret;
... ...
@@ -2137,7 +2102,7 @@ int add_actions(struct action* a, struct action** head)
2137 2102
 {
2138 2103
 	int ret;
2139 2104
 
2140
-	LOG(L_DBG, "add_actions: fixing actions...\n");
2105
+	LM_DBG("fixing actions...\n");
2141 2106
 	if ((ret=fix_actions(a))!=0) goto error;
2142 2107
 	push(a,head);
2143 2108
 	return 0;