Browse code

action.c: logging: convert LOG to LM_*

Ovidiu Sas authored on 03/10/2014 18:19:36
Showing 1 changed files
... ...
@@ -426,8 +426,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
426 426
 				}
427 427
 
428 428
 				if (ret<0) {
429
-					LOG(L_ERR, "ERROR: do_action: forward: bad_uri "
430
-								" dropping packet\n");
429
+					LM_ERR("forward: bad_uri dropping packet\n");
431 430
 					goto error;
432 431
 				}
433 432
 
... ...
@@ -439,8 +438,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
439 439
 									port=a->val[1].u.number;
440 440
 									break;
441 441
 					default:
442
-							LOG(L_CRIT, "BUG: do_action bad forward 2nd"
443
-										" param type (%d)\n", a->val[1].type);
442
+							LM_CRIT("bad forward 2nd param type (%d)\n", a->val[1].type);
444 443
 							ret=E_UNSPEC;
445 444
 							goto error_fwd_uri;
446 445
 				}
... ...
@@ -466,16 +464,14 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
466 466
 							dst.proto=u->proto;
467 467
 							break;
468 468
 						default:
469
-							LOG(L_ERR,"ERROR: do action: forward: bad uri"
470
-									" transport %d\n", u->proto);
469
+							LM_ERR("forward: bad uri transport %d\n", u->proto);
471 470
 							ret=E_BAD_PROTO;
472 471
 							goto error_fwd_uri;
473 472
 					}
474 473
 #ifdef USE_TLS
475 474
 					if (u->type==SIPS_URI_T){
476 475
 						if (u->proto==PROTO_UDP){
477
-							LOG(L_ERR, "ERROR: do_action: forward: secure uri"
478
-									" incompatible with transport %d\n",
476
+							LM_ERR("forward: secure uri incompatible with transport %d\n",
479 477
 									u->proto);
480 478
 							ret=E_BAD_PROTO;
481 479
 							goto error_fwd_uri;
... ...
@@ -512,7 +508,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
512 512
 					proxy_mark((struct proxy_l*)a->val[0].u.data, ret);
513 513
 				}
514 514
 			}else{
515
-				LOG(L_CRIT, "BUG: do_action: bad forward() types %d, %d\n",
515
+				LM_CRIT("bad forward() types %d, %d\n",
516 516
 						a->val[0].type, a->val[1].type);
517 517
 				ret=E_BUG;
518 518
 				goto error;
... ...
@@ -520,7 +516,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
520 520
 			break;
521 521
 		case LOG_T:
522 522
 			if ((a->val[0].type!=NUMBER_ST)|(a->val[1].type!=STRING_ST)){
523
-				LOG(L_CRIT, "BUG: do_action: bad log() types %d, %d\n",
523
+				LM_CRIT("bad log() types %d, %d\n",
524 524
 						a->val[0].type, a->val[1].type);
525 525
 				ret=E_BUG;
526 526
 				goto error;
... ...
@@ -533,8 +529,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
533 533
 		/* jku -- introduce a new branch */
534 534
 		case APPEND_BRANCH_T:
535 535
 			if (unlikely(a->val[0].type!=STR_ST)) {
536
-				LOG(L_CRIT, "BUG: do_action: bad append_branch_t %d\n",
537
-					a->val[0].type );
536
+				LM_CRIT("bad append_branch_t %d\n", a->val[0].type );
538 537
 				ret=E_BUG;
539 538
 				goto error;
540 539
 			}
... ...
@@ -568,8 +563,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
568 568
 		/* jku begin: is_length_greater_than */
569 569
 		case LEN_GT_T:
570 570
 			if (a->val[0].type!=NUMBER_ST) {
571
-				LOG(L_CRIT, "BUG: do_action: bad len_gt type %d\n",
572
-					a->val[0].type );
571
+				LM_CRIT("bad len_gt type %d\n", a->val[0].type );
573 572
 				ret=E_BUG;
574 573
 				goto error;
575 574
 			}
... ...
@@ -583,8 +577,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
583 583
 
584 584
 		case SETFLAG_T:
585 585
 			if (a->val[0].type!=NUMBER_ST) {
586
-				LOG(L_CRIT, "BUG: do_action: bad setflag() type %d\n",
587
-					a->val[0].type );
586
+				LM_CRIT("bad setflag() type %d\n", a->val[0].type );
588 587
 				ret=E_BUG;
589 588
 				goto error;
590 589
 			}
... ...
@@ -598,8 +591,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
598 598
 
599 599
 		case RESETFLAG_T:
600 600
 			if (a->val[0].type!=NUMBER_ST) {
601
-				LOG(L_CRIT, "BUG: do_action: bad resetflag() type %d\n",
602
-					a->val[0].type );
601
+				LM_CRIT("bad resetflag() type %d\n", a->val[0].type );
603 602
 				ret=E_BUG;
604 603
 				goto error;
605 604
 			}
... ...
@@ -613,8 +605,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
613 613
 
614 614
 		case ISFLAGSET_T:
615 615
 			if (a->val[0].type!=NUMBER_ST) {
616
-				LOG(L_CRIT, "BUG: do_action: bad isflagset() type %d\n",
617
-					a->val[0].type );
616
+				LM_CRIT("bad isflagset() type %d\n", a->val[0].type );
618 617
 				ret=E_BUG;
619 618
 				goto error;
620 619
 			}
... ...
@@ -670,12 +661,11 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
670 670
 			break;
671 671
 		case ERROR_T:
672 672
 			if ((a->val[0].type!=STRING_ST)|(a->val[1].type!=STRING_ST)){
673
-				LOG(L_CRIT, "BUG: do_action: bad error() types %d, %d\n",
674
-						a->val[0].type, a->val[1].type);
673
+				LM_CRIT("bad error() types %d, %d\n", a->val[0].type, a->val[1].type);
675 674
 				ret=E_BUG;
676 675
 				goto error;
677 676
 			}
678
-			LOG(L_NOTICE, "WARNING: do_action: error(\"%s\", \"%s\") "
677
+			LM_NOTICE("error(\"%s\", \"%s\") "
679 678
 					"not implemented yet\n", a->val[0].u.string, a->val[1].u.string);
680 679
 			ret=1;
681 680
 			break;
... ...
@@ -707,13 +697,12 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
707 707
 				rval_cache_clean(&c1);
708 708
 				s.s = 0;
709 709
 			} else {
710
-				LOG(L_CRIT, "BUG: do_action: bad route() type %d\n",
711
-						a->val[0].type);
710
+				LM_CRIT("bad route() type %d\n", a->val[0].type);
712 711
 				ret=E_BUG;
713 712
 				goto error;
714 713
 			}
715 714
 			if (unlikely((i>=main_rt.idx)||(i<0))){
716
-				LOG(L_ERR, "ERROR: invalid routing table number in"
715
+				LM_ERR("invalid routing table number in"
717 716
 							"route(%lu) at %s:%d\n", a->val[0].u.number,
718 717
 							(a->cfile)?a->cfile:"line", a->cline);
719 718
 				ret=E_CFG;
... ...
@@ -727,16 +716,15 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
727 727
 			break;
728 728
 		case EXEC_T:
729 729
 			if (a->val[0].type!=STRING_ST){
730
-				LOG(L_CRIT, "BUG: do_action: bad exec() type %d\n",
731
-						a->val[0].type);
730
+				LM_CRIT("bad exec() type %d\n", a->val[0].type);
732 731
 				ret=E_BUG;
733 732
 				goto error;
734 733
 			}
735
-			LOG(L_NOTICE, "WARNING: exec(\"%s\") not fully implemented,"
734
+			LM_NOTICE("exec(\"%s\") not fully implemented,"
736 735
 						" using dumb version...\n", a->val[0].u.string);
737 736
 			ret=system(a->val[0].u.string);
738 737
 			if (ret!=0){
739
-				LOG(L_NOTICE, "WARNING: exec() returned %d\n", ret);
738
+				LM_NOTICE("exec() returned %d\n", ret);
740 739
 			}
741 740
 			ret=1;
742 741
 			break;
... ...
@@ -765,15 +753,13 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
765 765
 				user=0;
766 766
 				if (a->type==STRIP_T || a->type==STRIP_TAIL_T) {
767 767
 					if (a->val[0].type!=NUMBER_ST) {
768
-						LOG(L_CRIT, "BUG: do_action: bad set*() type %d\n",
769
-							a->val[0].type);
768
+						LM_CRIT("bad set*() type %d\n", a->val[0].type);
770 769
 						ret=E_BUG;
771 770
 						goto error;
772 771
 					}
773 772
 				} else if (a->type!=SET_USERPHONE_T) {
774 773
 					if (a->val[0].type!=STRING_ST) {
775
-						LOG(L_CRIT, "BUG: do_action: bad set*() type %d\n",
776
-							a->val[0].type);
774
+						LM_CRIT("bad set*() type %d\n", a->val[0].type);
777 775
 						ret=E_BUG;
778 776
 						goto error;
779 777
 					}
... ...
@@ -787,8 +773,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
787 787
 					len=strlen(a->val[0].u.string);
788 788
 					msg->new_uri.s=pkg_malloc(len+1);
789 789
 					if (msg->new_uri.s==0){
790
-						LOG(L_ERR, "ERROR: do_action: memory allocation"
791
-								" failure\n");
790
+						LM_ERR("memory allocation failure\n");
792 791
 						ret=E_OUT_OF_MEM;
793 792
 						goto error;
794 793
 					}
... ...
@@ -809,8 +794,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
809 809
 						len=msg->first_line.u.request.uri.len;
810 810
 					}
811 811
 					if (parse_uri(tmp, len, &uri)<0){
812
-						LOG(L_ERR, "ERROR: do_action: bad uri <%s>, dropping"
813
-									" packet\n", tmp);
812
+						LM_ERR("bad uri <%s>, dropping packet\n", tmp);
814 813
 						ret=E_UNSPEC;
815 814
 						goto error;
816 815
 					}
... ...
@@ -832,15 +816,14 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
832 832
 					&& ((uri.type==TEL_URI_T) || (uri.type==TELS_URI_T))
833 833
 					&& ((uri.flags & URI_SIP_USER_PHONE)==0)
834 834
 				) {
835
-					LOG(L_ERR, "ERROR: do_action: port number of a tel: URI cannot be set\n");
835
+					LM_ERR("port number of a tel: URI cannot be set\n");
836 836
 					ret=E_UNSPEC;
837 837
 					goto error;
838 838
 				}
839 839
 
840 840
 				new_uri=pkg_malloc(MAX_URI_SIZE);
841 841
 				if (new_uri==0){
842
-					LOG(L_ERR, "ERROR: do_action: memory allocation "
843
-								" failure\n");
842
+					LM_ERR("memory allocation failure\n");
844 843
 					ret=E_OUT_OF_MEM;
845 844
 					goto error;
846 845
 				}
... ...
@@ -889,8 +872,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
889 889
 					break;
890 890
 
891 891
 				default:
892
-					LOG(L_ERR, "ERROR: Unsupported URI scheme (%d), "
893
-						"reverted to sip:\n",
892
+					LM_ERR("Unsupported URI scheme (%d), reverted to sip:\n",
894 893
 						uri.type);
895 894
 					len=s_sip.len;
896 895
 					tmp=s_sip.s;
... ...
@@ -916,8 +898,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
916 916
 					len=strlen(tmp);
917 917
 				} else if (a->type==STRIP_T) {
918 918
 					if (a->val[0].u.number>uri.user.len) {
919
-						LOG(L_WARN, "Error: too long strip asked; "
920
-									" deleting username: %lu of <%.*s>\n",
919
+						LM_WARN("too long strip asked; deleting username: %lu of <%.*s>\n",
921 920
 									a->val[0].u.number, uri.user.len, uri.user.s );
922 921
 						len=0;
923 922
 					} else if (a->val[0].u.number==uri.user.len) {
... ...
@@ -928,7 +909,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
928 928
 					}
929 929
 				} else if (a->type==STRIP_TAIL_T) {
930 930
 					if (a->val[0].u.number>uri.user.len) {
931
-						LOG(L_WARN, "WARNING: too long strip_tail asked; "
931
+						LM_WARN("too long strip_tail asked; "
932 932
 									" deleting username: %lu of <%.*s>\n",
933 933
 									a->val[0].u.number, uri.user.len, uri.user.s );
934 934
 						len=0;
... ...
@@ -1396,8 +1377,7 @@ match_cleanup:
1396 1396
 					i++;
1397 1397
 
1398 1398
 				if (unlikely(i > cfg_get(core, core_cfg, max_while_loops))){
1399
-					LOG(L_ERR, "ERROR: runaway while (%d, %d): more then"
1400
-								" %d loops\n", 
1399
+					LM_ERR("runaway while (%d, %d): more then %d loops\n", 
1401 1400
 								rve->fpos.s_line, rve->fpos.s_col,
1402 1401
 								cfg_get(core, core_cfg, max_while_loops));
1403 1402
 					ret=-1;
... ...
@@ -1425,8 +1405,7 @@ match_cleanup:
1425 1425
 			break;
1426 1426
 		case SET_ADV_ADDR_T:
1427 1427
 			if (a->val[0].type!=STR_ST){
1428
-				LOG(L_CRIT, "BUG: do_action: bad set_advertised_address() "
1429
-						"type %d\n", a->val[0].type);
1428
+				LM_CRIT("bad set_advertised_address() type %d\n", a->val[0].type);
1430 1429
 				ret=E_BUG;
1431 1430
 				goto error;
1432 1431
 			}
... ...
@@ -1435,8 +1414,7 @@ match_cleanup:
1435 1435
 			break;
1436 1436
 		case SET_ADV_PORT_T:
1437 1437
 			if (a->val[0].type!=STR_ST){
1438
-				LOG(L_CRIT, "BUG: do_action: bad set_advertised_port() "
1439
-						"type %d\n", a->val[0].type);
1438
+				LM_CRIT("bad set_advertised_port() type %d\n", a->val[0].type);
1440 1439
 				ret=E_BUG;
1441 1440
 				goto error;
1442 1441
 			}
... ...
@@ -1454,7 +1432,7 @@ match_cleanup:
1454 1454
 				if (a->val[0].type==NOSUBTYPE)	port=msg->via1->port;
1455 1455
 				else if (a->val[0].type==NUMBER_ST) port=(int)a->val[0].u.number;
1456 1456
 				else{
1457
-					LOG(L_CRIT, "BUG: do_action: bad force_tcp_alias"
1457
+					LM_CRIT("bad force_tcp_alias"
1458 1458
 							" port type %d\n", a->val[0].type);
1459 1459
 					ret=E_BUG;
1460 1460
 					goto error;
... ...
@@ -1462,7 +1440,7 @@ match_cleanup:
1462 1462
 
1463 1463
 				if (tcpconn_add_alias(msg->rcv.proto_reserved1, port,
1464 1464
 									msg->rcv.proto)!=0){
1465
-					LOG(L_ERR, " ERROR: receive_msg: tcp alias failed\n");
1465
+					LM_ERR("receive_msg: tcp alias failed\n");
1466 1466
 					ret=E_UNSPEC;
1467 1467
 					goto error;
1468 1468
 				}
... ...
@@ -1472,7 +1450,7 @@ match_cleanup:
1472 1472
 			break;
1473 1473
 		case FORCE_SEND_SOCKET_T:
1474 1474
 			if (a->val[0].type!=SOCKETINFO_ST){
1475
-				LOG(L_CRIT, "BUG: do_action: bad force_send_socket argument"
1475
+				LM_CRIT("bad force_send_socket argument"
1476 1476
 						" type: %d\n", a->val[0].type);
1477 1477
 				ret=E_BUG;
1478 1478
 				goto error;
... ...
@@ -1544,14 +1522,14 @@ match_cleanup:
1544 1544
 			break;
1545 1545
 /*
1546 1546
 		default:
1547
-			LOG(L_CRIT, "BUG: do_action: unknown type %d\n", a->type);
1547
+			LM_CRIT("unknown type %d\n", a->type);
1548 1548
 */
1549 1549
 	}
1550 1550
 skip:
1551 1551
 	return ret;
1552 1552
 
1553 1553
 error_uri:
1554
-	LOG(L_ERR, "ERROR: do_action: set*: uri too long\n");
1554
+	LM_ERR("set*: uri too long\n");
1555 1555
 	if (new_uri) pkg_free(new_uri);
1556 1556
 	LM_ERR("run action error at: %s:%d\n", (a->cfile)?a->cfile:"", a->cline);
1557 1557
 	return E_UNSPEC;
... ...
@@ -1576,8 +1554,7 @@ int run_actions(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
1576 1576
 	ret=E_UNSPEC;
1577 1577
 	h->rec_lev++;
1578 1578
 	if (unlikely(h->rec_lev>max_recursive_level)){
1579
-		LOG(L_ERR, "WARNING: too many recursive routing table lookups (%d)"
1580
-					" giving up!\n", h->rec_lev);
1579
+		LM_ERR("too many recursive routing table lookups (%d) giving up!\n", h->rec_lev);
1581 1580
 		ret=E_UNSPEC;
1582 1581
 		goto error;
1583 1582
 	}
... ...
@@ -1595,8 +1572,7 @@ int run_actions(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
1595 1595
 	}
1596 1596
 
1597 1597
 	if (unlikely(a==0)){
1598
-		DBG("DEBUG: run_actions: null action list (rec_level=%d)\n",
1599
-				h->rec_lev);
1598
+		DBG("DEBUG: run_actions: null action list (rec_level=%d)\n", h->rec_lev);
1600 1599
 		ret=1;
1601 1600
 	}
1602 1601