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 552
 			   before MATCH_OP and other fixups) */
553 553
 			if (exp->l_type==RVEXP_O){
554 554
 				if ((ret=fix_rval_expr(exp->l.param))<0){
555
-					ERR("Unable to fix left rval expression\n");
555
+					LM_ERR("Unable to fix left rval expression\n");
556 556
 					return ret;
557 557
 				}
558 558
 				if (scr_opt_lev>=2)
... ...
@@ -560,7 +559,7 @@ int fix_expr(struct expr* exp)
560 560
 			}
561 561
 			if (exp->r_type==RVE_ST){
562 562
 				if ((ret=fix_rval_expr(exp->r.param))<0){
563
-					ERR("Unable to fix right rval expression\n");
563
+					LM_ERR("Unable to fix right rval expression\n");
564 564
 					return ret;
565 565
 				}
566 566
 				if (scr_opt_lev>=2)
... ...
@@ -576,14 +575,12 @@ int fix_expr(struct expr* exp)
576 576
 				if (exp->r_type==STRING_ST){
577 577
 					re=(regex_t*)pkg_malloc(sizeof(regex_t));
578 578
 					if (re==0){
579
-						LOG(L_CRIT, "ERROR: fix_expr: memory allocation"
580
-								" failure\n");
579
+						LM_CRIT("memory allocation failure\n");
581 580
 						return E_OUT_OF_MEM;
582 581
 					}
583 582
 					if (regcomp(re, (char*) exp->r.param,
584 583
 								REG_EXTENDED|REG_NOSUB|REG_ICASE) ){
585
-						LOG(L_CRIT, "ERROR: fix_expr : bad re \"%s\"\n",
586
-									(char*) exp->r.param);
584
+						LM_CRIT("bad re \"%s\"\n", (char*) exp->r.param);
587 585
 						pkg_free(re);
588 586
 						return E_BAD_RE;
589 587
 					}
... ...
@@ -596,20 +593,20 @@ int fix_expr(struct expr* exp)
596 596
 						exp->r_type != SELECT_UNFIXED_ST &&
597 597
 						exp->r_type!= RVE_ST
598 598
 						&& exp->r_type != PVAR_ST){
599
-					LOG(L_CRIT, "BUG: fix_expr : invalid type for match\n");
599
+					LM_CRIT("invalid type for match\n");
600 600
 					return E_BUG;
601 601
 				}
602 602
 			}
603 603
 			if (exp->l_type==ACTION_O){
604 604
 				ret=fix_actions((struct action*)exp->r.param);
605 605
 				if (ret!=0){
606
-					LOG(L_CRIT, "ERROR: fix_expr : fix_actions error\n");
606
+					LM_CRIT("fix_actions error\n");
607 607
 					return ret;
608 608
 				}
609 609
 			}
610 610
 			if (exp->l_type==SELECT_UNFIXED_O) {
611 611
 				if ((ret=resolve_select(exp->l.select)) < 0) {
612
-					ERR("Unable to resolve select\n");
612
+					LM_ERR("Unable to resolve select\n");
613 613
 					print_select(exp->l.select);
614 614
 					return ret;
615 615
 				}
... ...
@@ -617,7 +614,7 @@ int fix_expr(struct expr* exp)
617 617
 			}
618 618
 			if (exp->r_type==SELECT_UNFIXED_ST) {
619 619
 				if ((ret=resolve_select(exp->r.select)) < 0) {
620
-					ERR("Unable to resolve select\n");
620
+					LM_ERR("Unable to resolve select\n");
621 621
 					print_select(exp->r.select);
622 622
 					return ret;
623 623
 				}
... ...
@@ -654,7 +651,7 @@ int fix_actions(struct action* a)
654 654
 	int rve_param_no;
655 655
 
656 656
 	if (a==0){
657
-		LOG(L_CRIT,"BUG: fix_actions: null pointer\n");
657
+		LM_CRIT("null pointer\n");
658 658
 		return E_BUG;
659 659
 	}
660 660
 	for(t=a; t!=0; t=t->next){
... ...
@@ -669,8 +666,7 @@ int fix_actions(struct action* a)
669 669
 							tmp=strdup(ip_addr2a(
670 670
 										(struct ip_addr*)t->val[0].u.data));
671 671
 							if (tmp==0){
672
-								LOG(L_CRIT, "ERROR: fix_actions:"
673
-										"memory allocation failure\n");
672
+								LM_CRIT("memory allocation failure\n");
674 673
 								ret = E_OUT_OF_MEM;
675 674
 								goto error;
676 675
 							}
... ...
@@ -688,8 +684,7 @@ int fix_actions(struct action* a)
688 688
 						case URIHOST_ST:
689 689
 							break;
690 690
 						default:
691
-							LOG(L_CRIT, "BUG: fix_actions: invalid type"
692
-									"%d (should be string or number)\n",
691
+							LM_CRIT("invalid type %d (should be string or number)\n",
693 692
 										t->type);
694 693
 							ret = E_BUG;
695 694
 							goto error;
... ...
@@ -697,22 +692,19 @@ int fix_actions(struct action* a)
697 697
 					break;
698 698
 			case IF_T:
699 699
 				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",
700
+					LM_CRIT("invalid subtype %d for if (should be rval expr)\n",
702 701
 								t->val[0].type);
703 702
 					ret = E_BUG;
704 703
 					goto error;
705 704
 				}else if( (t->val[1].type!=ACTIONS_ST) &&
706 705
 							(t->val[1].type!=NOSUBTYPE) ){
707
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
708
-								"%d for if() {...} (should be action)\n",
706
+					LM_CRIT("invalid subtype %d for if() {...} (should be action)\n",
709 707
 								t->val[1].type);
710 708
 					ret = E_BUG;
711 709
 					goto error;
712 710
 				}else if( (t->val[2].type!=ACTIONS_ST) &&
713 711
 							(t->val[2].type!=NOSUBTYPE) ){
714
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
715
-								"%d for if() {} else{...}(should be action)\n",
712
+					LM_CRIT("invalid subtype %d for if() {} else{...}(should be action)\n",
716 713
 								t->val[2].type);
717 714
 					ret = E_BUG;
718 715
 					goto error;
... ...
@@ -723,7 +715,7 @@ int fix_actions(struct action* a)
723 723
 					if (!rve_check_type(&rve_type, rve, &err_rve,
724 724
 											&err_type, &expected_type)){
725 725
 						if (err_rve)
726
-							LOG(L_ERR, "fix_actions: invalid expression "
726
+							LM_ERR("invalid expression "
727 727
 									"(%d,%d): subexpression (%d,%d) has type"
728 728
 									" %s,  but %s is expected\n",
729 729
 									rve->fpos.s_line, rve->fpos.s_col,
... ...
@@ -731,8 +723,7 @@ int fix_actions(struct action* a)
731 731
 									rval_type_name(err_type),
732 732
 									rval_type_name(expected_type) );
733 733
 						else
734
-							LOG(L_ERR, "fix_actions: invalid expression "
735
-									"(%d,%d): type mismatch?",
734
+							LM_ERR("invalid expression  (%d,%d): type mismatch?",
736 735
 									rve->fpos.s_line, rve->fpos.s_col);
737 736
 						ret = E_SCRIPT;
738 737
 						goto error;
... ...
@@ -741,7 +732,7 @@ int fix_actions(struct action* a)
741 741
 					   only a script warning (to allow backward compat. stuff
742 742
 					   like if (@ruri) 
743 743
 					if (rve_type!=RV_INT && rve_type!=RV_NONE){
744
-						LOG(L_ERR, "fix_actions: invalid expression (%d,%d):"
744
+						LM_ERR("fix_actions: invalid expression (%d,%d):"
745 745
 								" bad type, integer expected\n",
746 746
 								rve->fpos.s_line, rve->fpos.s_col);
747 747
 						return E_UNSPEC;
... ...
@@ -762,14 +753,12 @@ int fix_actions(struct action* a)
762 762
 				break;
763 763
 			case SWITCH_T:
764 764
 				if (t->val[0].type!=RVE_ST){
765
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
766
-								"%d for switch() (should be expr)\n",
765
+					LM_CRIT("invalid subtype %d for switch() (should be expr)\n",
767 766
 								t->val[0].type);
768 767
 					ret = E_BUG;
769 768
 					goto error;
770 769
 				}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",
770
+					LM_CRIT("invalid subtype %d for switch(...){...}(should be case)\n",
773 771
 								t->val[1].type);
774 772
 					ret = E_BUG;
775 773
 					goto error;
... ...
@@ -778,8 +767,7 @@ int fix_actions(struct action* a)
778 778
 					if ((ret=fix_rval_expr(t->val[0].u.data))<0)
779 779
 						goto error;
780 780
 				}else{
781
-					LOG(L_CRIT, "BUG: fix_actions: null switch()"
782
-							" expression\n");
781
+					LM_CRIT("null switch() expression\n");
783 782
 					ret = E_BUG;
784 783
 					goto error;
785 784
 				}
... ...
@@ -788,14 +776,12 @@ int fix_actions(struct action* a)
788 788
 				break;
789 789
 			case WHILE_T:
790 790
 				if (t->val[0].type!=RVE_ST){
791
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
792
-								"%d for while() (should be expr)\n",
791
+					LM_CRIT("invalid subtype %d for while() (should be expr)\n",
793 792
 								t->val[0].type);
794 793
 					ret = E_BUG;
795 794
 					goto error;
796 795
 				}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",
796
+					LM_CRIT("invalid subtype %d for while(...){...}(should be action)\n",
799 797
 								t->val[1].type);
800 798
 					ret = E_BUG;
801 799
 					goto error;
... ...
@@ -806,7 +792,7 @@ int fix_actions(struct action* a)
806 806
 					if (!rve_check_type(&rve_type, rve, &err_rve,
807 807
 											&err_type, &expected_type)){
808 808
 						if (err_rve)
809
-							LOG(L_ERR, "fix_actions: invalid expression "
809
+							LM_ERR("invalid expression "
810 810
 									"(%d,%d): subexpression (%d,%d) has type"
811 811
 									" %s,  but %s is expected\n",
812 812
 									rve->fpos.s_line, rve->fpos.s_col,
... ...
@@ -814,15 +800,13 @@ int fix_actions(struct action* a)
814 814
 									rval_type_name(err_type),
815 815
 									rval_type_name(expected_type) );
816 816
 						else
817
-							LOG(L_ERR, "fix_actions: invalid expression "
818
-									"(%d,%d): type mismatch?",
817
+							LM_ERR("invalid expression (%d,%d): type mismatch?",
819 818
 									rve->fpos.s_line, rve->fpos.s_col);
820 819
 						ret = E_SCRIPT;
821 820
 						goto error;
822 821
 					}
823 822
 					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",
823
+						LM_ERR("invalid expression (%d,%d): bad type, integer expected\n",
826 824
 								rve->fpos.s_line, rve->fpos.s_col);
827 825
 						ret = E_SCRIPT;
828 826
 						goto error;
... ...
@@ -830,8 +814,7 @@ int fix_actions(struct action* a)
830 830
 					if ((ret=fix_rval_expr(t->val[0].u.data))<0)
831 831
 						goto error;
832 832
 				}else{
833
-					LOG(L_CRIT, "BUG: fix_actions: null while()"
834
-							" expression\n");
833
+					LM_CRIT("null while() expression\n");
835 834
 					ret = E_BUG;
836 835
 					goto error;
837 836
 				}
... ...
@@ -850,7 +833,7 @@ int fix_actions(struct action* a)
850 850
 					if (!rve_check_type(&rve_type, rve, &err_rve,
851 851
 											&err_type, &expected_type)){
852 852
 						if (err_rve)
853
-							LOG(L_ERR, "fix_actions: invalid expression "
853
+							LM_ERR("invalid expression "
854 854
 									"(%d,%d): subexpression (%d,%d) has type"
855 855
 									" %s,  but %s is expected\n",
856 856
 									rve->fpos.s_line, rve->fpos.s_col,
... ...
@@ -858,15 +841,13 @@ int fix_actions(struct action* a)
858 858
 									rval_type_name(err_type),
859 859
 									rval_type_name(expected_type) );
860 860
 						else
861
-							LOG(L_ERR, "fix_actions: invalid expression "
862
-									"(%d,%d): type mismatch?",
861
+							LM_ERR("invalid expression (%d,%d): type mismatch?",
863 862
 									rve->fpos.s_line, rve->fpos.s_col);
864 863
 						ret = E_SCRIPT;
865 864
 						goto error;
866 865
 					}
867 866
 					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",
867
+						LM_ERR("invalid expression (%d,%d): bad type, integer expected\n",
870 868
 								rve->fpos.s_line, rve->fpos.s_col);
871 869
 						ret = E_SCRIPT;
872 870
 						goto error;
... ...
@@ -874,8 +855,7 @@ int fix_actions(struct action* a)
874 874
 					if ((ret=fix_rval_expr(t->val[0].u.data))<0)
875 875
 						goto error;
876 876
 				}else{
877
-					LOG(L_CRIT, "BUG: fix_actions: null drop/return"
878
-							" expression\n");
877
+					LM_CRIT("null drop/return expression\n");
879 878
 					ret = E_BUG;
880 879
 					goto error;
881 880
 				}
... ...
@@ -883,27 +863,26 @@ int fix_actions(struct action* a)
883 883
 			case ASSIGN_T:
884 884
 			case ADD_T:
885 885
 				if (t->val[0].type !=LVAL_ST) {
886
-					LOG(L_CRIT, "BUG: fix_actions: Invalid left side of"
887
-								" assignment\n");
886
+					LM_CRIT("Invalid left side of assignment\n");
888 887
 					ret = E_BUG;
889 888
 					goto error;
890 889
 				}
891 890
 				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);
891
+					LM_CRIT("Invalid right side of assignment (%d)\n",
892
+								t->val[1].type);
894 893
 					ret = E_BUG;
895 894
 					goto error;
896 895
 				}
897 896
 				lval=t->val[0].u.data;
898 897
 				if (lval->type==LV_AVP){
899 898
 					if (lval->lv.avps.type & AVP_CLASS_DOMAIN) {
900
-						LOG(L_ERR, "ERROR: You cannot change domain"
899
+						LM_ERR("You cannot change domain"
901 900
 									" attributes from the script, they are"
902 901
 									" read-only\n");
903 902
 						ret = E_BUG;
904 903
 						goto error;
905 904
 					} else if (lval->lv.avps.type & AVP_CLASS_GLOBAL) {
906
-						LOG(L_ERR, "ERROR: You cannot change global"
905
+						LM_ERR("You cannot change global"
907 906
 								   " attributes from the script, they are"
908 907
 								   "read-only\n");
909 908
 						ret = E_BUG;
... ...
@@ -1031,8 +1010,7 @@ int fix_actions(struct action* a)
1031 1031
 				break;
1032 1032
 			case FORCE_SEND_SOCKET_T:
1033 1033
 				if (t->val[0].type!=SOCKID_ST){
1034
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
1035
-								"%d for force_send_socket\n",
1034
+					LM_CRIT("invalid subtype %d for force_send_socket\n",
1036 1035
 								t->val[0].type);
1037 1036
 					ret = E_BUG;
1038 1037
 					goto error;
... ...
@@ -1041,8 +1019,7 @@ int fix_actions(struct action* a)
1041 1041
 						((struct socket_id*)t->val[0].u.data)->addr_lst->name
1042 1042
 						);
1043 1043
 				if (he==0){
1044
-					LOG(L_ERR, "ERROR: fix_actions: force_send_socket:"
1045
-								" could not resolve %s\n",
1044
+					LM_ERR("force_send_socket: could not resolve %s\n",
1046 1045
 						((struct socket_id*)t->val[0].u.data)->addr_lst->name);
1047 1046
 					ret = E_BAD_ADDRESS;
1048 1047
 					goto error;
... ...
@@ -1051,8 +1028,7 @@ int fix_actions(struct action* a)
1051 1051
 				si=find_si(&ip, ((struct socket_id*)t->val[0].u.data)->port,
1052 1052
 								((struct socket_id*)t->val[0].u.data)->proto);
1053 1053
 				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",
1054
+					LM_ERR("bad force_send_socket argument: %s:%d (ser doesn't listen on it)\n",
1056 1055
 						((struct socket_id*)t->val[0].u.data)->addr_lst->name,
1057 1056
 							((struct socket_id*)t->val[0].u.data)->port);
1058 1057
 					ret = E_BAD_ADDRESS;
... ...
@@ -1063,8 +1039,7 @@ int fix_actions(struct action* a)
1063 1063
 				break;
1064 1064
 			case UDP_MTU_TRY_PROTO_T:
1065 1065
 				if (t->val[0].type!=NUMBER_ST){
1066
-					LOG(L_CRIT, "BUG: fix_actions: invalid subtype"
1067
-								"%d for udp_mtu_try_proto\n",
1066
+					LM_CRIT("invalid subtype %d for udp_mtu_try_proto\n",
1068 1067
 								t->val[0].type);
1069 1068
 					ret = E_BUG;
1070 1069
 					goto error;
... ...
@@ -1083,8 +1058,7 @@ int fix_actions(struct action* a)
1083 1083
 						t->val[0].u.number=FL_MTU_SCTP_FB;
1084 1084
 						break;
1085 1085
 					default:
1086
-						LOG(L_CRIT, "BUG: fix actions: invalid argument for"
1087
-									" udp_mtu_try_proto (%d)\n", 
1086
+						LM_CRIT("invalid argument for udp_mtu_try_proto (%d)\n", 
1088 1087
 									(unsigned int)t->val[0].u.number);
1089 1088
 				}
1090 1089
 				break;
... ...
@@ -1105,7 +1079,7 @@ int fix_actions(struct action* a)
1105 1105
 					rve=(struct rval_expr*)t->val[0].u.data;
1106 1106
 					if (!rve_is_constant(rve)) {
1107 1107
 						if ((ret=fix_rval_expr(t->val[0].u.data)) < 0){
1108
-							ERR("route() failed to fix rve at %s:%d\n",
1108
+							LM_ERR("route() failed to fix rve at %s:%d\n",
1109 1109
 								(t->cfile)?t->cfile:"line", t->cline);
1110 1110
 							ret = E_BUG;
1111 1111
 							goto error;
... ...
@@ -1116,7 +1090,7 @@ int fix_actions(struct action* a)
1116 1116
 								rval_get_str(0, 0, &s, rv, 0) < 0) {
1117 1117
 							/* out of mem. or bug ? */
1118 1118
 							rval_destroy(rv);
1119
-							ERR("route() failed to fix ct. rve at %s:%d\n",
1119
+							LM_ERR("route() failed to fix ct. rve at %s:%d\n",
1120 1120
 								(t->cfile)?t->cfile:"line", t->cline);
1121 1121
 							ret = E_BUG;
1122 1122
 							goto error;
... ...
@@ -1132,7 +1106,7 @@ int fix_actions(struct action* a)
1132 1132
 				if (t->val[0].type == STRING_ST) {
1133 1133
 					i=route_lookup(&main_rt, t->val[0].u.string);
1134 1134
 					if (i < 0) {
1135
-						ERR("route \"%s\" not found at %s:%d\n",
1135
+						LM_ERR("route \"%s\" not found at %s:%d\n",
1136 1136
 								t->val[0].u.string,
1137 1137
 								(t->cfile)?t->cfile:"line", t->cline);
1138 1138
 						ret = E_SCRIPT;
... ...
@@ -1159,7 +1133,7 @@ int fix_actions(struct action* a)
1159 1159
 						rv = rval_expr_eval(0, 0, rve);
1160 1160
 						if (rv == 0 ||
1161 1161
 								rval_get_int( 0, 0, &i, rv, 0) < 0 ) {
1162
-							ERR("failed to fix constant rve");
1162
+							LM_ERR("failed to fix constant rve");
1163 1163
 							if (rv) rval_destroy(rv);
1164 1164
 							ret = E_BUG;
1165 1165
 							goto error;
... ...
@@ -1173,7 +1147,7 @@ int fix_actions(struct action* a)
1173 1173
 						   optimize it */
1174 1174
 						if ((ret=fix_rval_expr(rve))
1175 1175
 								< 0) {
1176
-							ERR("rve fixup failed\n");
1176
+							LM_ERR("rve fixup failed\n");
1177 1177
 							ret = E_BUG;
1178 1178
 							goto error;
1179 1179
 						}
... ...
@@ -1194,7 +1168,7 @@ int fix_actions(struct action* a)
1194 1194
 				}
1195 1195
 				tmp_p = (void *)cfg_lookup_group(t->val[0].u.string, strlen(t->val[0].u.string));
1196 1196
 				if (!tmp_p) {
1197
-					ERR("configuration group \"%s\" not found\n",
1197
+					LM_ERR("configuration group \"%s\" not found\n",
1198 1198
 						t->val[0].u.string);
1199 1199
 					ret = E_SCRIPT;
1200 1200
 					goto error;
... ...
@@ -1260,7 +1234,7 @@ inline static int comp_num(int op, long left, int rtype, union exp_op* r,
1260 1260
 			}
1261 1261
 			break;
1262 1262
 		default:
1263
-			LOG(L_CRIT, "BUG: comp_num: Invalid right operand (%d)\n", rtype);
1263
+			LM_CRIT("Invalid right operand (%d)\n", rtype);
1264 1264
 			return E_BUG;
1265 1265
 	}
1266 1266
 
... ...
@@ -1272,7 +1246,7 @@ inline static int comp_num(int op, long left, int rtype, union exp_op* r,
1272 1272
 		case GTE_OP:   return (long)left >= (long)right;
1273 1273
 		case LTE_OP:   return (long)left <= (long)right;
1274 1274
 		default:
1275
-			LOG(L_CRIT, "BUG: comp_num: unknown operator: %d\n", op);
1275
+			LM_CRIT("unknown operator: %d\n", op);
1276 1276
 			return E_BUG;
1277 1277
 	}
1278 1278
 	return E_BUG;
... ...
@@ -1340,8 +1314,7 @@ inline static int comp_str(int op, str* left, int rtype,
1340 1340
 			break;
1341 1341
 		case RE_ST:
1342 1342
 			if (unlikely(op != MATCH_OP)){
1343
-				LOG(L_CRIT, "BUG: comp_str: Bad operator %d,"
1344
-							" ~= expected\n", op);
1343
+				LM_CRIT("Bad operator %d, ~= expected\n", op);
1345 1344
 				goto error;
1346 1345
 			}
1347 1346
 			break;
... ...
@@ -1359,8 +1332,7 @@ inline static int comp_str(int op, str* left, int rtype,
1359 1359
 				goto error;
1360 1360
 			return comp_num(op, l, rtype, r, msg, h);
1361 1361
 		default:
1362
-			LOG(L_CRIT, "BUG: comp_str: Bad type %d, "
1363
-						"string or RE expected\n", rtype);
1362
+			LM_CRIT("Bad type %d, string or RE expected\n", rtype);
1364 1363
 			goto error;
1365 1364
 	}
1366 1365
 
... ...
@@ -1404,8 +1376,7 @@ inline static int comp_str(int op, str* left, int rtype,
1404 1404
 					/* we need to compile the RE on the fly */
1405 1405
 					re=(regex_t*)pkg_malloc(sizeof(regex_t));
1406 1406
 					if (re==0){
1407
-						LOG(L_CRIT, "ERROR: comp_strstr: memory allocation"
1408
-									 " failure\n");
1407
+						LM_CRIT("memory allocation failure\n");
1409 1408
 						left->s[left->len] = backup;
1410 1409
 						goto error;
1411 1410
 					}
... ...
@@ -1423,14 +1394,13 @@ inline static int comp_str(int op, str* left, int rtype,
1423 1423
 					ret=(regexec(r->re, left->s, 0, 0, 0)==0);
1424 1424
 					break;
1425 1425
 				default:
1426
-					LOG(L_CRIT, "BUG: comp_str: Bad operator type %d, "
1427
-								"for ~= \n", rtype);
1426
+					LM_CRIT("Bad operator type %d, for ~= \n", rtype);
1428 1427
 					goto error;
1429 1428
 			}
1430 1429
 			left->s[left->len] = backup;
1431 1430
 			break;
1432 1431
 		default:
1433
-			LOG(L_CRIT, "BUG: comp_str: unknown op %d\n", op);
1432
+			LM_CRIT("unknown op %d\n", op);
1434 1433
 			goto error;
1435 1434
 	}
1436 1435
 	if (rv){
... ...
@@ -1503,8 +1473,7 @@ inline static int comp_avp(int op, avp_spec_t* spec, int rtype,
1503 1503
 				tmp.s=r->string;
1504 1504
 				tmp.len=strlen(r->string);
1505 1505
 				if (str2int(&tmp, &uval)<0){
1506
-					LOG(L_WARN, "WARNING: comp_avp: cannot convert"
1507
-								" string value to int (%s)\n",
1506
+					LM_WARN("cannot convert string value to int (%s)\n",
1508 1507
 								ZSW(r->string));
1509 1508
 					goto error;
1510 1509
 				}
... ...
@@ -1512,15 +1481,15 @@ inline static int comp_avp(int op, avp_spec_t* spec, int rtype,
1512 1512
 				return comp_num(op, val.n, NUMBER_ST, &num_val, msg, h);
1513 1513
 			case STR_ST:
1514 1514
 				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));
1515
+					LM_WARN("cannot convert str value to int (%.*s)\n",
1516
+								r->str.len, ZSW(r->str.s));
1517 1517
 					goto error;
1518 1518
 				}
1519 1519
 				num_val.numval=uval;
1520 1520
 				return comp_num(op, val.n, NUMBER_ST, &num_val, msg, h);
1521 1521
 			default:
1522
-				LOG(L_CRIT, "BUG: comp_avp: invalid type for numeric avp "
1523
-							"comparison (%d)\n", rtype);
1522
+				LM_CRIT("invalid type for numeric avp comparison (%d)\n",
1523
+								rtype);
1524 1524
 				goto error;
1525 1525
 		}
1526 1526
 	}
... ...
@@ -1564,7 +1533,7 @@ inline static int comp_rve(int op, struct rval_expr* rve, int rtype,
1564 1564
 	
1565 1565
 	rval_cache_init(&c1);
1566 1566
 	if (unlikely(rval_expr_eval_rvint(h,  msg, &rv, &i, rve, &c1)<0)){
1567
-		ERR("failure evaluating expression: bad type\n");
1567
+		LM_ERR("failure evaluating expression: bad type\n");
1568 1568
 		i=0; /* false */
1569 1569
 		goto int_expr;
1570 1570
 	}
... ...
@@ -1635,7 +1604,7 @@ inline static int check_self_op(int op, str* s, unsigned short p)
1635 1635
 			ret=(ret > 0) ? 0 : 1;
1636 1636
 			break;
1637 1637
 		default:
1638
-			LOG(L_CRIT, "BUG: check_self_op: invalid operator %d\n", op);
1638
+			LM_CRIT("invalid operator %d\n", op);
1639 1639
 			ret=-1;
1640 1640
 	}
1641 1641
 	return ret;
... ...
@@ -1751,8 +1720,7 @@ inline static int comp_ip(int op, struct ip_addr* ip, int rtype,
1751 1751
 			}
1752 1752
 			return ret;
1753 1753
 		default:
1754
-			LOG(L_CRIT, "BUG: comp_ip: invalid type for "
1755
-						" src_ip or dst_ip (%d)\n", rtype);
1754
+			LM_CRIT("invalid type for src_ip or dst_ip (%d)\n", rtype);
1756 1755
 			return -1;
1757 1756
 	}
1758 1757
 	/* 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 1838
 		pv_value_destroy(&pval);
1839 1839
 	return ret;
1840 1840
 error_op:
1841
-	LOG(L_CRIT, "BUG: comp_ip: invalid operator %d for type %d\n", op, rtype);
1841
+	LM_CRIT("invalid operator %d for type %d\n", op, rtype);
1842 1842
 error:
1843 1843
 	if (unlikely(rv)){
1844 1844
 		rval_cache_clean(&rv_cache);
... ...
@@ -1862,7 +1830,7 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
1862 1862
 	ret=E_BUG;
1863 1863
 
1864 1864
 	if (e->type!=ELEM_T){
1865
-		LOG(L_CRIT," BUG: eval_elem: invalid type\n");
1865
+		LM_CRIT("invalid type\n");
1866 1866
 		goto error;
1867 1867
 	}
1868 1868
 	switch(e->l_type){
... ...
@@ -1905,14 +1873,13 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
1905 1905
 
1906 1906
 	case FROM_URI_O:
1907 1907
 		if (parse_from_header(msg)!=0){
1908
-			LOG(L_ERR, "ERROR: eval_elem: bad or missing"
1909
-			    " From: header\n");
1908
+			LM_ERR("bad or missing From: header\n");
1910 1909
 			goto error;
1911 1910
 		}
1912 1911
 		if (e->r_type==MYSELF_ST){
1913 1912
 			if (parse_uri(get_from(msg)->uri.s, get_from(msg)->uri.len,
1914 1913
 				      &uri) < 0){
1915
-				LOG(L_ERR, "ERROR: eval_elem: bad uri in From:\n");
1914
+				LM_ERR("bad uri in From:\n");
1916 1915
 				goto error;
1917 1916
 			}
1918 1917
 			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 1925
 	case TO_URI_O:
1926 1926
 		if ((msg->to==0) && ((parse_headers(msg, HDR_TO_F, 0)==-1) ||
1927 1927
 				     (msg->to==0))){
1928
-			LOG(L_ERR, "ERROR: eval_elem: bad or missing"
1929
-			    " To: header\n");
1928
+			LM_ERR("bad or missing To: header\n");
1930 1929
 			goto error;
1931 1930
 		}
1932 1931
 		     /* to content is parsed automatically */
1933 1932
 		if (e->r_type==MYSELF_ST){
1934 1933
 			if (parse_uri(get_to(msg)->uri.s, get_to(msg)->uri.len,
1935 1934
 				      &uri) < 0){
1936
-				LOG(L_ERR, "ERROR: eval_elem: bad uri in To:\n");
1935
+				LM_ERR("bad uri in To:\n");
1937 1936
 				goto error;
1938 1937
 			}
1939 1938
 			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 2070
 		break;
2071 2071
 /*
2072 2072
 	default:
2073
-		LOG(L_CRIT, "BUG: eval_elem: invalid operand %d\n",
2074
-		    e->l_type);
2073
+		LM_CRIT("invalid operand %d\n", e->l_type);
2075 2074
 */
2076 2075
 	}
2077 2076
 	return ret;
... ...
@@ -2107,11 +2072,11 @@ int eval_expr(struct run_act_ctx* h, struct expr* e, struct sip_msg* msg)
2107 2107
 				ret=(ret > 0) ? 0 : 1;
2108 2108
 				break;
2109 2109
 			default:
2110
-				LOG(L_CRIT, "BUG: eval_expr: unknown op %d\n", e->op);
2110
+				LM_CRIT("unknown op %d\n", e->op);
2111 2111
 				ret=-1;
2112 2112
 		}
2113 2113
 	}else{
2114
-		LOG(L_CRIT, "BUG: eval_expr: unknown type %d\n", e->type);
2114
+		LM_CRIT("unknown type %d\n", e->type);
2115 2115
 		ret=-1;
2116 2116
 	}
2117 2117
 	return ret;
... ...
@@ -2137,7 +2102,7 @@ int add_actions(struct action* a, struct action** head)
2137 2137
 {
2138 2138
 	int ret;
2139 2139
 
2140
-	LOG(L_DBG, "add_actions: fixing actions...\n");
2140
+	LM_DBG("fixing actions...\n");
2141 2141
 	if ((ret=fix_actions(a))!=0) goto error;
2142 2142
 	push(a,head);
2143 2143
 	return 0;