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 438
 									port=a->val[1].u.number;
440 439
 									break;
441 440
 					default:
442
-							LOG(L_CRIT, "BUG: do_action bad forward 2nd"
443
-										" param type (%d)\n", a->val[1].type);
441
+							LM_CRIT("bad forward 2nd param type (%d)\n", a->val[1].type);
444 442
 							ret=E_UNSPEC;
445 443
 							goto error_fwd_uri;
446 444
 				}
... ...
@@ -466,16 +464,14 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
466 464
 							dst.proto=u->proto;
467 465
 							break;
468 466
 						default:
469
-							LOG(L_ERR,"ERROR: do action: forward: bad uri"
470
-									" transport %d\n", u->proto);
467
+							LM_ERR("forward: bad uri transport %d\n", u->proto);
471 468
 							ret=E_BAD_PROTO;
472 469
 							goto error_fwd_uri;
473 470
 					}
474 471
 #ifdef USE_TLS
475 472
 					if (u->type==SIPS_URI_T){
476 473
 						if (u->proto==PROTO_UDP){
477
-							LOG(L_ERR, "ERROR: do_action: forward: secure uri"
478
-									" incompatible with transport %d\n",
474
+							LM_ERR("forward: secure uri incompatible with transport %d\n",
479 475
 									u->proto);
480 476
 							ret=E_BAD_PROTO;
481 477
 							goto error_fwd_uri;
... ...
@@ -512,7 +508,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
512 508
 					proxy_mark((struct proxy_l*)a->val[0].u.data, ret);
513 509
 				}
514 510
 			}else{
515
-				LOG(L_CRIT, "BUG: do_action: bad forward() types %d, %d\n",
511
+				LM_CRIT("bad forward() types %d, %d\n",
516 512
 						a->val[0].type, a->val[1].type);
517 513
 				ret=E_BUG;
518 514
 				goto error;
... ...
@@ -520,7 +516,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
520 516
 			break;
521 517
 		case LOG_T:
522 518
 			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",
519
+				LM_CRIT("bad log() types %d, %d\n",
524 520
 						a->val[0].type, a->val[1].type);
525 521
 				ret=E_BUG;
526 522
 				goto error;
... ...
@@ -533,8 +529,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
533 529
 		/* jku -- introduce a new branch */
534 530
 		case APPEND_BRANCH_T:
535 531
 			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 );
532
+				LM_CRIT("bad append_branch_t %d\n", a->val[0].type );
538 533
 				ret=E_BUG;
539 534
 				goto error;
540 535
 			}
... ...
@@ -568,8 +563,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
568 563
 		/* jku begin: is_length_greater_than */
569 564
 		case LEN_GT_T:
570 565
 			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 );
566
+				LM_CRIT("bad len_gt type %d\n", a->val[0].type );
573 567
 				ret=E_BUG;
574 568
 				goto error;
575 569
 			}
... ...
@@ -583,8 +577,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
583 577
 
584 578
 		case SETFLAG_T:
585 579
 			if (a->val[0].type!=NUMBER_ST) {
586
-				LOG(L_CRIT, "BUG: do_action: bad setflag() type %d\n",
587
-					a->val[0].type );
580
+				LM_CRIT("bad setflag() type %d\n", a->val[0].type );
588 581
 				ret=E_BUG;
589 582
 				goto error;
590 583
 			}
... ...
@@ -598,8 +591,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
598 591
 
599 592
 		case RESETFLAG_T:
600 593
 			if (a->val[0].type!=NUMBER_ST) {
601
-				LOG(L_CRIT, "BUG: do_action: bad resetflag() type %d\n",
602
-					a->val[0].type );
594
+				LM_CRIT("bad resetflag() type %d\n", a->val[0].type );
603 595
 				ret=E_BUG;
604 596
 				goto error;
605 597
 			}
... ...
@@ -613,8 +605,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
613 605
 
614 606
 		case ISFLAGSET_T:
615 607
 			if (a->val[0].type!=NUMBER_ST) {
616
-				LOG(L_CRIT, "BUG: do_action: bad isflagset() type %d\n",
617
-					a->val[0].type );
608
+				LM_CRIT("bad isflagset() type %d\n", a->val[0].type );
618 609
 				ret=E_BUG;
619 610
 				goto error;
620 611
 			}
... ...
@@ -670,12 +661,11 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
670 661
 			break;
671 662
 		case ERROR_T:
672 663
 			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);
664
+				LM_CRIT("bad error() types %d, %d\n", a->val[0].type, a->val[1].type);
675 665
 				ret=E_BUG;
676 666
 				goto error;
677 667
 			}
678
-			LOG(L_NOTICE, "WARNING: do_action: error(\"%s\", \"%s\") "
668
+			LM_NOTICE("error(\"%s\", \"%s\") "
679 669
 					"not implemented yet\n", a->val[0].u.string, a->val[1].u.string);
680 670
 			ret=1;
681 671
 			break;
... ...
@@ -707,13 +697,12 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
707 697
 				rval_cache_clean(&c1);
708 698
 				s.s = 0;
709 699
 			} else {
710
-				LOG(L_CRIT, "BUG: do_action: bad route() type %d\n",
711
-						a->val[0].type);
700
+				LM_CRIT("bad route() type %d\n", a->val[0].type);
712 701
 				ret=E_BUG;
713 702
 				goto error;
714 703
 			}
715 704
 			if (unlikely((i>=main_rt.idx)||(i<0))){
716
-				LOG(L_ERR, "ERROR: invalid routing table number in"
705
+				LM_ERR("invalid routing table number in"
717 706
 							"route(%lu) at %s:%d\n", a->val[0].u.number,
718 707
 							(a->cfile)?a->cfile:"line", a->cline);
719 708
 				ret=E_CFG;
... ...
@@ -727,16 +716,15 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
727 716
 			break;
728 717
 		case EXEC_T:
729 718
 			if (a->val[0].type!=STRING_ST){
730
-				LOG(L_CRIT, "BUG: do_action: bad exec() type %d\n",
731
-						a->val[0].type);
719
+				LM_CRIT("bad exec() type %d\n", a->val[0].type);
732 720
 				ret=E_BUG;
733 721
 				goto error;
734 722
 			}
735
-			LOG(L_NOTICE, "WARNING: exec(\"%s\") not fully implemented,"
723
+			LM_NOTICE("exec(\"%s\") not fully implemented,"
736 724
 						" using dumb version...\n", a->val[0].u.string);
737 725
 			ret=system(a->val[0].u.string);
738 726
 			if (ret!=0){
739
-				LOG(L_NOTICE, "WARNING: exec() returned %d\n", ret);
727
+				LM_NOTICE("exec() returned %d\n", ret);
740 728
 			}
741 729
 			ret=1;
742 730
 			break;
... ...
@@ -765,15 +753,13 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
765 753
 				user=0;
766 754
 				if (a->type==STRIP_T || a->type==STRIP_TAIL_T) {
767 755
 					if (a->val[0].type!=NUMBER_ST) {
768
-						LOG(L_CRIT, "BUG: do_action: bad set*() type %d\n",
769
-							a->val[0].type);
756
+						LM_CRIT("bad set*() type %d\n", a->val[0].type);
770 757
 						ret=E_BUG;
771 758
 						goto error;
772 759
 					}
773 760
 				} else if (a->type!=SET_USERPHONE_T) {
774 761
 					if (a->val[0].type!=STRING_ST) {
775
-						LOG(L_CRIT, "BUG: do_action: bad set*() type %d\n",
776
-							a->val[0].type);
762
+						LM_CRIT("bad set*() type %d\n", a->val[0].type);
777 763
 						ret=E_BUG;
778 764
 						goto error;
779 765
 					}
... ...
@@ -787,8 +773,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
787 773
 					len=strlen(a->val[0].u.string);
788 774
 					msg->new_uri.s=pkg_malloc(len+1);
789 775
 					if (msg->new_uri.s==0){
790
-						LOG(L_ERR, "ERROR: do_action: memory allocation"
791
-								" failure\n");
776
+						LM_ERR("memory allocation failure\n");
792 777
 						ret=E_OUT_OF_MEM;
793 778
 						goto error;
794 779
 					}
... ...
@@ -809,8 +794,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
809 794
 						len=msg->first_line.u.request.uri.len;
810 795
 					}
811 796
 					if (parse_uri(tmp, len, &uri)<0){
812
-						LOG(L_ERR, "ERROR: do_action: bad uri <%s>, dropping"
813
-									" packet\n", tmp);
797
+						LM_ERR("bad uri <%s>, dropping packet\n", tmp);
814 798
 						ret=E_UNSPEC;
815 799
 						goto error;
816 800
 					}
... ...
@@ -832,15 +816,14 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
832 816
 					&& ((uri.type==TEL_URI_T) || (uri.type==TELS_URI_T))
833 817
 					&& ((uri.flags & URI_SIP_USER_PHONE)==0)
834 818
 				) {
835
-					LOG(L_ERR, "ERROR: do_action: port number of a tel: URI cannot be set\n");
819
+					LM_ERR("port number of a tel: URI cannot be set\n");
836 820
 					ret=E_UNSPEC;
837 821
 					goto error;
838 822
 				}
839 823
 
840 824
 				new_uri=pkg_malloc(MAX_URI_SIZE);
841 825
 				if (new_uri==0){
842
-					LOG(L_ERR, "ERROR: do_action: memory allocation "
843
-								" failure\n");
826
+					LM_ERR("memory allocation failure\n");
844 827
 					ret=E_OUT_OF_MEM;
845 828
 					goto error;
846 829
 				}
... ...
@@ -889,8 +872,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
889 872
 					break;
890 873
 
891 874
 				default:
892
-					LOG(L_ERR, "ERROR: Unsupported URI scheme (%d), "
893
-						"reverted to sip:\n",
875
+					LM_ERR("Unsupported URI scheme (%d), reverted to sip:\n",
894 876
 						uri.type);
895 877
 					len=s_sip.len;
896 878
 					tmp=s_sip.s;
... ...
@@ -916,8 +898,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
916 898
 					len=strlen(tmp);
917 899
 				} else if (a->type==STRIP_T) {
918 900
 					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",
901
+						LM_WARN("too long strip asked; deleting username: %lu of <%.*s>\n",
921 902
 									a->val[0].u.number, uri.user.len, uri.user.s );
922 903
 						len=0;
923 904
 					} 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 909
 					}
929 910
 				} else if (a->type==STRIP_TAIL_T) {
930 911
 					if (a->val[0].u.number>uri.user.len) {
931
-						LOG(L_WARN, "WARNING: too long strip_tail asked; "
912
+						LM_WARN("too long strip_tail asked; "
932 913
 									" deleting username: %lu of <%.*s>\n",
933 914
 									a->val[0].u.number, uri.user.len, uri.user.s );
934 915
 						len=0;
... ...
@@ -1396,8 +1377,7 @@ match_cleanup:
1396 1377
 					i++;
1397 1378
 
1398 1379
 				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", 
1380
+					LM_ERR("runaway while (%d, %d): more then %d loops\n", 
1401 1381
 								rve->fpos.s_line, rve->fpos.s_col,
1402 1382
 								cfg_get(core, core_cfg, max_while_loops));
1403 1383
 					ret=-1;
... ...
@@ -1425,8 +1405,7 @@ match_cleanup:
1425 1405
 			break;
1426 1406
 		case SET_ADV_ADDR_T:
1427 1407
 			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);
1408
+				LM_CRIT("bad set_advertised_address() type %d\n", a->val[0].type);
1430 1409
 				ret=E_BUG;
1431 1410
 				goto error;
1432 1411
 			}
... ...
@@ -1435,8 +1414,7 @@ match_cleanup:
1435 1414
 			break;
1436 1415
 		case SET_ADV_PORT_T:
1437 1416
 			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);
1417
+				LM_CRIT("bad set_advertised_port() type %d\n", a->val[0].type);
1440 1418
 				ret=E_BUG;
1441 1419
 				goto error;
1442 1420
 			}
... ...
@@ -1454,7 +1432,7 @@ match_cleanup:
1454 1432
 				if (a->val[0].type==NOSUBTYPE)	port=msg->via1->port;
1455 1433
 				else if (a->val[0].type==NUMBER_ST) port=(int)a->val[0].u.number;
1456 1434
 				else{
1457
-					LOG(L_CRIT, "BUG: do_action: bad force_tcp_alias"
1435
+					LM_CRIT("bad force_tcp_alias"
1458 1436
 							" port type %d\n", a->val[0].type);
1459 1437
 					ret=E_BUG;
1460 1438
 					goto error;
... ...
@@ -1462,7 +1440,7 @@ match_cleanup:
1462 1440
 
1463 1441
 				if (tcpconn_add_alias(msg->rcv.proto_reserved1, port,
1464 1442
 									msg->rcv.proto)!=0){
1465
-					LOG(L_ERR, " ERROR: receive_msg: tcp alias failed\n");
1443
+					LM_ERR("receive_msg: tcp alias failed\n");
1466 1444
 					ret=E_UNSPEC;
1467 1445
 					goto error;
1468 1446
 				}
... ...
@@ -1472,7 +1450,7 @@ match_cleanup:
1472 1450
 			break;
1473 1451
 		case FORCE_SEND_SOCKET_T:
1474 1452
 			if (a->val[0].type!=SOCKETINFO_ST){
1475
-				LOG(L_CRIT, "BUG: do_action: bad force_send_socket argument"
1453
+				LM_CRIT("bad force_send_socket argument"
1476 1454
 						" type: %d\n", a->val[0].type);
1477 1455
 				ret=E_BUG;
1478 1456
 				goto error;
... ...
@@ -1544,14 +1522,14 @@ match_cleanup:
1544 1522
 			break;
1545 1523
 /*
1546 1524
 		default:
1547
-			LOG(L_CRIT, "BUG: do_action: unknown type %d\n", a->type);
1525
+			LM_CRIT("unknown type %d\n", a->type);
1548 1526
 */
1549 1527
 	}
1550 1528
 skip:
1551 1529
 	return ret;
1552 1530
 
1553 1531
 error_uri:
1554
-	LOG(L_ERR, "ERROR: do_action: set*: uri too long\n");
1532
+	LM_ERR("set*: uri too long\n");
1555 1533
 	if (new_uri) pkg_free(new_uri);
1556 1534
 	LM_ERR("run action error at: %s:%d\n", (a->cfile)?a->cfile:"", a->cline);
1557 1535
 	return E_UNSPEC;
... ...
@@ -1576,8 +1554,7 @@ int run_actions(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
1576 1554
 	ret=E_UNSPEC;
1577 1555
 	h->rec_lev++;
1578 1556
 	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);
1557
+		LM_ERR("too many recursive routing table lookups (%d) giving up!\n", h->rec_lev);
1581 1558
 		ret=E_UNSPEC;
1582 1559
 		goto error;
1583 1560
 	}
... ...
@@ -1595,8 +1572,7 @@ int run_actions(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
1595 1572
 	}
1596 1573
 
1597 1574
 	if (unlikely(a==0)){
1598
-		DBG("DEBUG: run_actions: null action list (rec_level=%d)\n",
1599
-				h->rec_lev);
1575
+		DBG("DEBUG: run_actions: null action list (rec_level=%d)\n", h->rec_lev);
1600 1576
 		ret=1;
1601 1577
 	}
1602 1578