Browse code

- changed LOG with LM_*

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@2943 689a6050-402a-0410-94f2-e92a70836424

Anca Vamanu authored on 19/10/2007 15:15:01
Showing 101 changed files
... ...
@@ -64,7 +64,7 @@ inline static int load_rr_api( struct rr_binds *rrb )
64 64
 
65 65
 	/* import the RR auto-loading function */
66 66
 	if ( !(load_rr_v=(load_rr_f)find_export("load_rr", 0, 0))) {
67
-		LOG(L_ERR, "ERROR:rr:load_rr_api: can't import load_rr\n");
67
+		LM_ERR("failed to import load_rr\n");
68 68
 		return -1;
69 69
 	}
70 70
 	/* let the auto-loading function load all RR stuff */
... ...
@@ -73,22 +73,22 @@ static int is_preloaded(struct sip_msg* msg)
73 73
 	str tag;
74 74
 
75 75
 	if (!msg->to && parse_headers(msg, HDR_TO_F, 0) == -1) {
76
-		LOG(L_ERR, "is_preloaded: Cannot parse To header field\n");
76
+		LM_ERR("failed to parse To header field\n");
77 77
 		return -1;
78 78
 	}
79 79
 
80 80
 	if (!msg->to) {
81
-		LOG(L_ERR, "is_preloaded: To header field not found\n");
81
+		LM_ERR("To header field not found\n");
82 82
 		return -1;
83 83
 	}
84 84
 
85 85
 	tag = get_to(msg)->tag_value;
86 86
 	if (tag.s == 0 || tag.len == 0) {
87
-		DBG("is_preloaded: Yes\n");
87
+		LM_DBG("is_preloaded: Yes\n");
88 88
 		return 1;
89 89
 	}
90 90
 
91
-	DBG("is_preloaded: No\n");
91
+	LM_DBG("is_preloaded: No\n");
92 92
 	return 0;
93 93
 }
94 94
 
... ...
@@ -102,17 +102,17 @@ static int is_preloaded(struct sip_msg* msg)
102 102
 static inline int find_first_route(struct sip_msg* _m)
103 103
 {
104 104
 	if (parse_headers(_m, HDR_ROUTE_F, 0) == -1) {
105
-		LOG(L_ERR, "find_first_route: Error while parsing headers\n");
105
+		LM_ERR("failed to parse headers\n");
106 106
 		return -1;
107 107
 	} else {
108 108
 		if (_m->route) {
109 109
 			if (parse_rr(_m->route) < 0) {
110
-				LOG(L_ERR, "find_first_route: Error while parsing Route HF\n");
110
+				LM_ERR("failed to parse Route HF\n");
111 111
 				return -2;
112 112
 			}
113 113
 			return 0;
114 114
 		} else {
115
-			DBG("find_first_route: No Route headers found\n");
115
+			LM_DBG("No Route headers found\n");
116 116
 			return 1;
117 117
 		}
118 118
 	}
... ...
@@ -219,7 +219,7 @@ static inline int is_myself(str* _host, unsigned short _port)
219 219
 	if(i_user.len && i_user.len==_user->len
220 220
 			&& !strncmp(i_user.s, _user->s, _user->len))
221 221
 	{
222
-		DBG("DEBUG:rr:is_myself: this URI isn't mine\n");
222
+		LM_DBG("this URI isn't mine\n");
223 223
 		return -1;
224 224
 	}
225 225
 #endif
... ...
@@ -247,12 +247,12 @@ static inline int find_next_route(struct sip_msg* _m, struct hdr_field** _hdr)
247 247
 	      * occurrence of Route header
248 248
 	      */
249 249
 	if (parse_headers(_m, HDR_ROUTE_F, 1) == -1) {
250
-		LOG(L_ERR, "find_next_route: Error while parsing headers\n");
250
+		LM_ERR("failed to parse headers\n");
251 251
 		return -1;
252 252
 	}
253 253
 
254 254
 	if ((_m->last_header->type!=HDR_ROUTE_T) || (_m->last_header==*_hdr)) {
255
-		DBG("find_next_route: No next Route HF found\n");
255
+		LM_DBG("No next Route HF found\n");
256 256
 		return 1;
257 257
 	}
258 258
 
... ...
@@ -260,7 +260,7 @@ static inline int find_next_route(struct sip_msg* _m, struct hdr_field** _hdr)
260 260
 
261 261
  found:
262 262
 	if (parse_rr(ptr) < 0) {
263
-		LOG(L_ERR, "find_next_route: Error while parsing Route body\n");
263
+		LM_ERR("failed to parse Route body\n");
264 264
 		return -2;
265 265
 	}
266 266
 
... ...
@@ -369,14 +369,14 @@ static inline int save_ruri(struct sip_msg* _m)
369 369
 	      * Route HF in the message
370 370
 	      */
371 371
 	if (parse_headers(_m, HDR_EOH_F, 0) == -1) {
372
-		LOG(L_ERR, "save_ruri: Error while parsing message\n");
372
+		LM_ERR("failed to parse message\n");
373 373
 		return -1;
374 374
 	}
375 375
 
376 376
 	     /* Create an anchor */
377 377
 	anchor = anchor_lump(_m, _m->unparsed - _m->buf, 0, 0);
378 378
 	if (anchor == 0) {
379
-		LOG(L_ERR, "save_ruri: Can't get anchor\n");
379
+		LM_ERR("failed to get anchor\n");
380 380
 		return -2;
381 381
 	}
382 382
 
... ...
@@ -384,7 +384,7 @@ static inline int save_ruri(struct sip_msg* _m)
384 384
 	len = ROUTE_PREFIX_LEN + _m->first_line.u.request.uri.len + ROUTE_SUFFIX_LEN;
385 385
 	s = (char*)pkg_malloc(len);
386 386
 	if (!s) {
387
-		LOG(L_ERR, "save_ruri: No memory left\n");
387
+		LM_ERR("No memory pkg left\n");
388 388
 		return -3;
389 389
 	}
390 390
 
... ...
@@ -393,12 +393,12 @@ static inline int save_ruri(struct sip_msg* _m)
393 393
 	memcpy(s + ROUTE_PREFIX_LEN, _m->first_line.u.request.uri.s, _m->first_line.u.request.uri.len);
394 394
 	memcpy(s + ROUTE_PREFIX_LEN + _m->first_line.u.request.uri.len, ROUTE_SUFFIX, ROUTE_SUFFIX_LEN);
395 395
 
396
-	DBG("save_ruri: New header: '%.*s'\n", len, ZSW(s));
396
+	LM_DBG("New header: '%.*s'\n", len, ZSW(s));
397 397
 
398 398
 	     /* Insert it */
399 399
 	if (insert_new_lump_before(anchor, s, len, 0) == 0) {
400 400
 		pkg_free(s);
401
-		LOG(L_ERR, "save_ruri: Cannot insert lump\n");
401
+		LM_ERR("failed to insert lump\n");
402 402
 		return -4;
403 403
 	}
404 404
 
... ...
@@ -423,7 +423,7 @@ static inline int get_maddr_uri(str *uri, struct sip_uri *puri)
423 423
 	{
424 424
 		if (parse_uri(uri->s, uri->len, &turi) < 0)
425 425
 		{
426
-			LOG(L_ERR, "get_maddr_uri: Error while parsing the URI\n");
426
+			LM_ERR("failed to parse the URI\n");
427 427
 			return RR_ERROR;
428 428
 		}
429 429
 		puri = &turi;
... ...
@@ -435,7 +435,7 @@ static inline int get_maddr_uri(str *uri, struct sip_uri *puri)
435 435
 	/* sip: + maddr + : + port */
436 436
 	if( (puri->maddr_val.len) > ( RH_MADDR_PARAM_MAX_LEN - 10 ) )
437 437
 	{
438
-		LOG(L_ERR, "get_maddr_uri: Too long maddr parameter\n");
438
+		LM_ERR( "Too long maddr parameter\n");
439 439
 		return RR_ERROR;
440 440
 	}
441 441
 	memcpy( builturi, "sip:", 4 );
... ...
@@ -453,7 +453,7 @@ static inline int get_maddr_uri(str *uri, struct sip_uri *puri)
453 453
 	builturi[uri->len]='\0';
454 454
 	uri->s = builturi;
455 455
 
456
-	DBG("rr:get_maddr_uri: uri is %s\n", builturi );
456
+	LM_DBG("uri is %s\n", builturi );
457 457
 	return 0;
458 458
 }
459 459
 
... ...
@@ -471,18 +471,18 @@ static inline int handle_sr(struct sip_msg* _m, struct hdr_field* _hdr, rr_t* _r
471 471
 
472 472
 	     /* Next hop is strict router, save R-URI here */
473 473
 	if (save_ruri(_m) < 0) {
474
-		LOG(L_ERR, "handle_sr: Error while saving Request-URI\n");
474
+		LM_ERR("failed to save Request-URI\n");
475 475
 		return -1;
476 476
 	}
477 477
 	
478 478
 	     /* Put the first Route in Request-URI */
479 479
 	uri = _r->nameaddr.uri;
480 480
 	if(get_maddr_uri(&uri, 0)!=0) {
481
-		LOG(L_ERR, "after_strict: Error while checking maddr\n");
481
+		LM_ERR("failed to check maddr\n");
482 482
 		return RR_ERROR;
483 483
 	}
484 484
 	if (rewrite_uri(_m, &uri) < 0) {
485
-		LOG(L_ERR, "handle_sr: Error while rewriting request URI\n");
485
+		LM_ERR("failed to rewrite request URI\n");
486 486
 		return -2;
487 487
 	}
488 488
 
... ...
@@ -495,7 +495,7 @@ static inline int handle_sr(struct sip_msg* _m, struct hdr_field* _hdr, rr_t* _r
495 495
 	}
496 496
 
497 497
 	if (!del_lump(_m, rem_off - _m->buf, rem_len, 0)) {
498
-		LOG(L_ERR, "handle_sr: Can't remove Route HF\n");
498
+		LM_ERR("failed to remove Route HF\n");
499 499
 		return -9;
500 500
 	}			
501 501
 
... ...
@@ -513,7 +513,7 @@ static inline int find_rem_target(struct sip_msg* _m, struct hdr_field** _h, rr_
513 513
 	struct hdr_field* ptr, *last;
514 514
 
515 515
 	if (parse_headers(_m, HDR_EOH_F, 0) == -1) {
516
-		LOG(L_ERR, "find_rem_target: Error while parsing message header\n");
516
+		LM_ERR("failed to parse message header\n");
517 517
 		return -1;
518 518
 	}
519 519
 
... ...
@@ -527,7 +527,7 @@ static inline int find_rem_target(struct sip_msg* _m, struct hdr_field** _h, rr_
527 527
 
528 528
 	if (last) {
529 529
 		if (parse_rr(last) < 0) {
530
-			LOG(L_ERR, "find_rem_target: Error while parsing last Route HF\n");
530
+			LM_ERR("failed to parse last Route HF\n");
531 531
 			return -2;
532 532
 		}
533 533
 
... ...
@@ -540,7 +540,7 @@ static inline int find_rem_target(struct sip_msg* _m, struct hdr_field** _h, rr_
540 540
 		}
541 541
 		return 0;
542 542
 	} else {
543
-		LOG(L_ERR, "find_rem_target: Can't find last Route HF\n");
543
+		LM_ERR("search for last Route HF failed\n");
544 544
 		return 1;
545 545
 	}
546 546
 }
... ...
@@ -563,7 +563,7 @@ static inline int after_strict(struct sip_msg* _m)
563 563
 	uri = rt->nameaddr.uri;
564 564
 
565 565
 	if (parse_uri(uri.s, uri.len, &puri) < 0) {
566
-		LOG(L_ERR, "after_strict: Error while parsing the first route URI\n");
566
+		LM_ERR("failed to parse the first route URI\n");
567 567
 		return RR_ERROR;
568 568
 	}
569 569
 
... ...
@@ -580,8 +580,7 @@ static inline int after_strict(struct sip_msg* _m)
580 580
 		if (si) {
581 581
 			_m->force_send_socket = si;
582 582
 		} else {
583
-			LOG(L_WARN,"WARNING:rr:after_strict: no socket found for "
584
-				"match second RR\n");
583
+			LM_WARN("no socket found for match second RR\n");
585 584
 		}
586 585
 
587 586
 		if (!rt->next) {
... ...
@@ -589,16 +588,16 @@ static inline int after_strict(struct sip_msg* _m)
589 588
 			 * field immediately
590 589
 			 */
591 590
 			if (!del_lump(_m, hdr->name.s - _m->buf, hdr->len, 0)) {
592
-				LOG(L_ERR, "after_strict: Cannot remove Route HF\n");
591
+				LM_ERR("failed to remove Route HF\n");
593 592
 				return RR_ERROR;
594 593
 			}
595 594
 			res = find_next_route(_m, &hdr);
596 595
 			if (res < 0) {
597
-				LOG(L_ERR, "after_strict: Error while searching next route\n");
596
+				LM_ERR("searching next route failed\n");
598 597
 				return RR_ERROR;
599 598
 			}
600 599
 			if (res > 0) { /* No next route found */
601
-				DBG("after_strict: No next URI found\n");
600
+				LM_DBG("after_strict: No next URI found\n");
602 601
 				return NOT_RR_DRIVEN;
603 602
 			}
604 603
 			rt = (rr_t*)hdr->parsed;
... ...
@@ -607,7 +606,7 @@ static inline int after_strict(struct sip_msg* _m)
607 606
 		/* parse the new found uri */
608 607
 		uri = rt->nameaddr.uri;
609 608
 		if (parse_uri(uri.s, uri.len, &puri) < 0) {
610
-			LOG(L_ERR, "after_strict: Error while parsing URI\n");
609
+			LM_ERR("failed to parse URI\n");
611 610
 			return RR_ERROR;
612 611
 		}
613 612
 	}
... ...
@@ -619,8 +618,7 @@ static inline int after_strict(struct sip_msg* _m)
619 618
 	routed_params = _m->parsed_uri.params;
620 619
 
621 620
 	if (is_strict(&puri.params)) {
622
-		DBG("after_strict: Next hop: '%.*s' is strict router\n",
623
-			uri.len, ZSW(uri.s));
621
+		LM_DBG("Next hop: '%.*s' is strict router\n", uri.len, ZSW(uri.s));
624 622
 		/* Previous hop was a strict router and the next hop is strict
625 623
 		 * router too. There is no need to save R-URI again because it
626 624
 		 * is saved already. In fact, in this case we will behave exactly
... ...
@@ -631,11 +629,11 @@ static inline int after_strict(struct sip_msg* _m)
631 629
 		 * In this case we will simply put the URI in R-URI and forward it, 
632 630
 		 * which will work perfectly */
633 631
 		if(get_maddr_uri(&uri, &puri)!=0) {
634
-			LOG(L_ERR, "after_strict: Error while checking maddr\n");
632
+			LM_ERR("failed to check maddr\n");
635 633
 			return RR_ERROR;
636 634
 		}
637 635
 		if (rewrite_uri(_m, &uri) < 0) {
638
-			LOG(L_ERR, "after_strict: Error while rewriting request URI\n");
636
+			LM_ERR("failed to rewrite request URI\n");
639 637
 			return RR_ERROR;
640 638
 		}
641 639
 		
... ...
@@ -647,19 +645,19 @@ static inline int after_strict(struct sip_msg* _m)
647 645
 			rem_len = hdr->len;
648 646
 		}
649 647
 		if (!del_lump(_m, rem_off - _m->buf, rem_len, 0)) {
650
-			LOG(L_ERR, "after_strict: Cannot remove Route HF\n");
648
+			LM_ERR("failed to remove Route HF\n");
651 649
 			return RR_ERROR;
652 650
 		}
653 651
 	} else {
654
-		DBG("after_strict: Next hop: '%.*s' is loose router\n",
652
+		LM_DBG("Next hop: '%.*s' is loose router\n",
655 653
 			uri.len, ZSW(uri.s));
656 654
 
657 655
 		if(get_maddr_uri(&uri, &puri)!=0) {
658
-			LOG(L_ERR, "after_strict: Error while checking maddr\n");
656
+			LM_ERR("failed to check maddr\n");
659 657
 			return RR_ERROR;
660 658
 		}
661 659
 		if (set_dst_uri(_m, &uri) < 0) {
662
-			LOG(L_ERR, "after_strict: Error while setting dst_uri\n");
660
+			LM_ERR("failed to set dst_uri\n");
663 661
 			return RR_ERROR;
664 662
 		}
665 663
 
... ...
@@ -673,7 +671,7 @@ static inline int after_strict(struct sip_msg* _m)
673 671
 			rem_off = hdr->body.s;
674 672
 			rem_len = rt->nameaddr.name.s - hdr->body.s;
675 673
 			if (!del_lump(_m, rem_off - _m->buf, rem_len, 0)) {
676
-				LOG(L_ERR, "after_strict: Can't remove Route HF\n");
674
+				LM_ERR("failed to remove Route HF\n");
677 675
 				return RR_ERROR;
678 676
 			}
679 677
 		}
... ...
@@ -681,8 +679,7 @@ static inline int after_strict(struct sip_msg* _m)
681 679
 
682 680
 		res = find_rem_target(_m, &hdr, &rt, &prev);
683 681
 		if (res < 0) {
684
-			LOG(L_ERR, "after_strict: Error while looking for last "
685
-				"Route URI\n");
682
+			LM_ERR("searching for last Route URI failed\n");
686 683
 			return RR_ERROR;
687 684
 		} else if (res > 0) {
688 685
 			/* No remote target is an error */
... ...
@@ -691,19 +688,19 @@ static inline int after_strict(struct sip_msg* _m)
691 688
 
692 689
 		uri = rt->nameaddr.uri;
693 690
 		if(get_maddr_uri(&uri, 0)!=0) {
694
-			LOG(L_ERR, "after_strict: Error while checking maddr\n");
691
+			LM_ERR("checking maddr failed\n");
695 692
 			return RR_ERROR;
696 693
 		}
697 694
 		if (rewrite_uri(_m, &uri) < 0) {
698
-			LOG(L_ERR, "after_strict: Can't rewrite R-URI\n");
695
+			LM_ERR("failed to rewrite R-URI\n");
699 696
 			return RR_ERROR;
700 697
 		}
701 698
 
702 699
 		/* The first character if uri will be either '<' when it is the 
703 700
 		 * only URI in a Route header field or ',' if there is more than 
704 701
 		 * one URI in the header field */
705
-		DBG("after_strict: The last route URI: '%.*s'\n", 
706
-			rt->nameaddr.uri.len, ZSW(rt->nameaddr.uri.s));
702
+		LM_DBG("The last route URI: '%.*s'\n", rt->nameaddr.uri.len,
703
+				ZSW(rt->nameaddr.uri.s));
707 704
 
708 705
 		if (prev) {
709 706
 			rem_off = prev->nameaddr.name.s + prev->len;
... ...
@@ -713,7 +710,7 @@ static inline int after_strict(struct sip_msg* _m)
713 710
 			rem_len = hdr->len;
714 711
 		}
715 712
 		if (!del_lump(_m, rem_off - _m->buf, rem_len, 0)) {
716
-			LOG(L_ERR, "after_strict: Can't remove Route HF\n");
713
+			LM_ERR("failed to remove Route HF\n");
717 714
 			return RR_ERROR;
718 715
 		}
719 716
 	}
... ...
@@ -743,7 +740,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
743 740
 	uri = rt->nameaddr.uri;
744 741
 
745 742
 	if (parse_uri(uri.s, uri.len, &puri) < 0) {
746
-		LOG(L_ERR, "after_loose: Error while parsing the first route URI\n");
743
+		LM_ERR("failed to parse the first route URI\n");
747 744
 		return RR_ERROR;
748 745
 	}
749 746
 
... ...
@@ -755,7 +752,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
755 752
 	if (is_myself(&puri.host, puri.port_no))
756 753
 #endif
757 754
 	{
758
-		DBG("after_loose: Topmost route URI: '%.*s' is me\n",
755
+		LM_DBG("Topmost route URI: '%.*s' is me\n",
759 756
 			uri.len, ZSW(uri.s));
760 757
 		/* set the hooks for the params -bogdan */
761 758
 		routed_msg_id = _m->id;
... ...
@@ -766,16 +763,16 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
766 763
 			 * field immediately
767 764
 			 */
768 765
 			if (!del_lump(_m, hdr->name.s - _m->buf, hdr->len, 0)) {
769
-				LOG(L_ERR, "after_loose: Can't remove Route HF\n");
766
+				LM_ERR("failed to remove Route HF\n");
770 767
 				return RR_ERROR;
771 768
 			}
772 769
 			res = find_next_route(_m, &hdr);
773 770
 			if (res < 0) {
774
-				LOG(L_ERR, "after_loose: Error while finding next route\n");
771
+				LM_ERR("failed to find next route\n");
775 772
 				return RR_ERROR;
776 773
 			}
777 774
 			if (res > 0) { /* No next route found */
778
-				DBG("after_loose: No next URI found\n");
775
+				LM_DBG("No next URI found\n");
779 776
 				status = (preloaded ? NOT_RR_DRIVEN : RR_DRIVEN);
780 777
 				goto done;
781 778
 			}
... ...
@@ -786,32 +783,30 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
786 783
 			/* double route may occure due different IP and port, so force as
787 784
 			 * send interface the one advertise in second Route */
788 785
 			if (parse_uri(rt->nameaddr.uri.s,rt->nameaddr.uri.len,&puri)<0) {
789
-				LOG(L_ERR, "after_loose: Error while parsing the "
790
-					"double route URI\n");
786
+				LM_ERR("failed to parse the double route URI\n");
791 787
 				return RR_ERROR;
792 788
 			}
793 789
 			si = grep_sock_info( &puri.host, puri.port_no, puri.proto);
794 790
 			if (si) {
795 791
 				_m->force_send_socket = si;
796 792
 			} else {
797
-				LOG(L_WARN,"WARNING:rr:after_loose: no socket found for "
798
-					"match second RR\n");
793
+				LM_WARN("no socket found for match second RR\n");
799 794
 			}
800 795
 
801 796
 			if (!rt->next) {
802 797
 				/* No next route in the same header, remove the whole header
803 798
 				 * field immediately */
804 799
 				if (!del_lump(_m, hdr->name.s - _m->buf, hdr->len, 0)) {
805
-					LOG(L_ERR, "after_loose: Can't remove Route HF\n");
800
+					LM_ERR("failed to remove Route HF\n");
806 801
 					return RR_ERROR;
807 802
 				}
808 803
 				res = find_next_route(_m, &hdr);
809 804
 				if (res < 0) {
810
-					LOG(L_ERR,"after_loose: Error while finding next route\n");
805
+					LM_ERR("failed to find next route\n");
811 806
 					return RR_ERROR;
812 807
 				}
813 808
 				if (res > 0) { /* No next route found */
814
-					DBG("after_loose: No next URI found\n");
809
+					LM_DBG("no next URI found\n");
815 810
 					status = (preloaded ? NOT_RR_DRIVEN : RR_DRIVEN);
816 811
 					goto done;
817 812
 				}
... ...
@@ -821,7 +816,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
821 816
 		
822 817
 		uri = rt->nameaddr.uri;
823 818
 		if (parse_uri(uri.s, uri.len, &puri) < 0) {
824
-			LOG(L_ERR, "after_loose: Error while parsing the first route URI\n");
819
+			LM_ERR("failed to parse the first route URI\n");
825 820
 			return RR_ERROR;
826 821
 		}
827 822
 	} else {
... ...
@@ -830,26 +825,26 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
830 825
 		if(ret < 0)
831 826
 			return NOT_RR_DRIVEN;
832 827
 #endif
833
-		DBG("after_loose: Topmost URI is NOT myself\n");
828
+		LM_DBG("Topmost URI is NOT myself\n");
834 829
 	}
835 830
 
836
-	DBG("after_loose: URI to be processed: '%.*s'\n", uri.len, ZSW(uri.s));
831
+	LM_DBG("URI to be processed: '%.*s'\n", uri.len, ZSW(uri.s));
837 832
 	if (is_strict(&puri.params)) {
838
-		DBG("after_loose: Next URI is a strict router\n");
833
+		LM_DBG("Next URI is a strict router\n");
839 834
 		if (handle_sr(_m, hdr, rt) < 0) {
840
-			LOG(L_ERR, "after_loose: Error while handling strict router\n");
835
+			LM_ERR("failed to handle strict router\n");
841 836
 			return RR_ERROR;
842 837
 		}
843 838
 	} else {
844 839
 		/* Next hop is loose router */
845
-		DBG("after_loose: Next URI is a loose router\n");
840
+		LM_DBG("Next URI is a loose router\n");
846 841
 
847 842
 		if(get_maddr_uri(&uri, &puri)!=0) {
848
-			LOG(L_ERR, "after_loose: Error while checking maddr\n");
843
+			LM_ERR("checking maddr failed\n");
849 844
 			return RR_ERROR;
850 845
 		}
851 846
 		if (set_dst_uri(_m, &uri) < 0) {
852
-			LOG(L_ERR, "after_loose: Error while setting dst_uri\n");
847
+			LM_ERR("failed to set dst_uri\n");
853 848
 			return RR_ERROR;
854 849
 		}
855 850
 
... ...
@@ -858,7 +853,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
858 853
 		if (rt != hdr->parsed) {
859 854
 			if (!del_lump(_m, hdr->body.s - _m->buf, 
860 855
 			rt->nameaddr.name.s - hdr->body.s, 0)) {
861
-				LOG(L_ERR, "after_loose: Can't remove Route HF\n");
856
+				LM_ERR("failed to remove Route HF\n");
862 857
 				return RR_ERROR;
863 858
 			}
864 859
 		}
... ...
@@ -880,12 +875,12 @@ int loose_route(struct sip_msg* _m, char* _s1, char* _s2)
880 875
 	int ret;
881 876
 
882 877
 	if (find_first_route(_m) != 0) {
883
-		DBG("loose_route: There is no Route HF\n");
878
+		LM_DBG("There is no Route HF\n");
884 879
 		return -1;
885 880
 	}
886 881
 		
887 882
 	if (parse_sip_msg_uri(_m)<0) {
888
-		LOG(L_ERR, "loose_route: Error while parsing Request URI\n");
883
+		LM_ERR("failed to parse Request URI\n");
889 884
 		return -1;
890 885
 	}
891 886
 
... ...
@@ -930,7 +925,7 @@ int check_route_param(struct sip_msg * msg, regex_t* re)
930 925
 	/* do the well-known trick to convert to null terminted */
931 926
 	bk = params.s[params.len];
932 927
 	params.s[params.len] = 0;
933
-	DBG("DEBUG:rr:check_route_param: params are <%s>\n", params.s);
928
+	LM_DBG("params are <%s>\n", params.s);
934 929
 	if (regexec( re, params.s, 1, &pmatch, 0)!=0) {
935 930
 		params.s[params.len] = bk;
936 931
 		return -1;
... ...
@@ -1041,12 +1036,12 @@ int is_direction(struct sip_msg * msg, int dir)
1041 1036
 	ftag_val.len = 0;
1042 1037
 
1043 1038
 	if (get_route_param( msg, &ftag_param, &ftag_val)!=0) {
1044
-		DBG("DEBUG:rr:is_direction: param ftag not found\n");
1039
+		LM_DBG("param ftag not found\n");
1045 1040
 		goto downstream;
1046 1041
 	}
1047 1042
 
1048 1043
 	if ( ftag_val.s==0 || ftag_val.len==0 ) {
1049
-		DBG("DEBUG:rr:is_direction: param ftag has empty val\n");
1044
+		LM_DBG("param ftag has empty val\n");
1050 1045
 		goto downstream;
1051 1046
 	}
1052 1047
 
... ...
@@ -83,7 +83,7 @@ static inline int get_username(struct sip_msg* _m, str* _user)
83 83
 
84 84
 	     /* first try to look at r-uri for a username */
85 85
 	if (parse_uri(_m->first_line.u.request.uri.s, _m->first_line.u.request.uri.len, &puri) < 0) {
86
-		LOG(L_ERR, "get_username(): Error while parsing R-URI\n");
86
+		LM_ERR("failed to parse R-URI\n");
87 87
 		return -1;
88 88
 	}
89 89
 
... ...
@@ -94,7 +94,7 @@ static inline int get_username(struct sip_msg* _m, str* _user)
94 94
 	 */
95 95
 	if (!puri.user.len && _m->new_uri.s) {
96 96
 		if (parse_uri(_m->new_uri.s, _m->new_uri.len, &puri) < 0) {
97
-			LOG(L_ERR, "get_username(): Error while parsing new_uri\n");
97
+			LM_ERR("failed to parse new_uri\n");
98 98
 			return -2;
99 99
 	        }
100 100
 	}
... ...
@@ -114,7 +114,7 @@ static inline struct lump *insert_rr_param_lump(struct lump *before,
114 114
 	/* duplicate data in pkg mem */
115 115
 	s1 = (char*)pkg_malloc(l);
116 116
 	if (s1==0) {
117
-		LOG(L_ERR,"ERROR:rr:insert_r_param_lump: no more pkg mem (%d)\n",l);
117
+		LM_ERR("no more pkg mem (%d)\n",l);
118 118
 		return 0;
119 119
 	}
120 120
 	memcpy( s1, s, l);
... ...
@@ -122,7 +122,7 @@ static inline struct lump *insert_rr_param_lump(struct lump *before,
122 122
 	/* add lump */
123 123
 	rrp_l = insert_new_lump_before( before, s1, l, HDR_RECORDROUTE_T);
124 124
 	if (rrp_l==0) {
125
-		LOG(L_ERR,"ERROR:rr:insert_r_param_lump: failed to add before lump\n");
125
+		LM_ERR("failed to add before lump\n");
126 126
 		pkg_free(s1);
127 127
 		return 0;
128 128
 	}
... ...
@@ -155,7 +155,7 @@ static inline int build_rr(struct lump* _l, struct lump* _l2, str* user,
155 155
 	r2 = pkg_malloc(RR_R2_LEN);
156 156
 
157 157
 	if (!prefix || !suffix || !term || !r2) {
158
-		LOG(L_ERR, "build_rr(): No memory left\n");
158
+		LM_ERR("No more pkg memory\n");
159 159
 		if (suffix) pkg_free(suffix);
160 160
 		if (prefix) pkg_free(prefix);
161 161
 		if (term) pkg_free(term);
... ...
@@ -233,7 +233,7 @@ static inline int build_rr(struct lump* _l, struct lump* _l2, str* user,
233 233
 	return 0;
234 234
 	
235 235
 lump_err:
236
-	LOG(L_ERR, "build_rr(): Error while inserting lumps\n");
236
+	LM_ERR("failed to insert lumps\n");
237 237
 	if (prefix) pkg_free(prefix);
238 238
 	if (suffix) pkg_free(suffix);
239 239
 	if (r2) pkg_free(r2);
... ...
@@ -259,14 +259,14 @@ int record_route(struct sip_msg* _m, str *params)
259 259
 	
260 260
 	if (add_username) {
261 261
 		if (get_username(_m, &user) < 0) {
262
-			LOG(L_ERR, "insert_RR(): Error while extracting username\n");
262
+			LM_ERR("failed to extract username\n");
263 263
 			return -1;
264 264
 		}
265 265
 	}
266 266
 
267 267
 	if (append_fromtag) {
268 268
 		if (parse_from_header(_m) < 0) {
269
-			LOG(L_ERR, "insert_RR(): From parsing failed\n");
269
+			LM_ERR("From parsing failed\n");
270 270
 			return -2;
271 271
 		}
272 272
 		from = (struct to_body*)_m->from->parsed;
... ...
@@ -284,18 +284,17 @@ int record_route(struct sip_msg* _m, str *params)
284 284
 		l = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, 0);
285 285
 		l2 = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, 0);
286 286
 		if (!l || !l2) {
287
-			LOG(L_ERR, "insert_RR(): Error while creating an anchor\n");
287
+			LM_ERR("failed to create an anchor\n");
288 288
 			return -5;
289 289
 		}
290 290
 		l = insert_cond_lump_after(l, COND_IF_DIFF_REALMS, 0);
291 291
 		l2 = insert_cond_lump_before(l2, COND_IF_DIFF_REALMS, 0);
292 292
 		if (!l || !l2) {
293
-			LOG(L_ERR,"insert_RR(): Error while inserting conditional lump\n");
293
+			LM_ERR("failed to insert conditional lump\n");
294 294
 			return -6;
295 295
 		}
296 296
 		if (build_rr(l, l2, &user, tag, params, OUTBOUND) < 0) {
297
-			LOG(L_ERR, "insert_RR(): Error while inserting outbound "
298
-				"Record-Route\n");
297
+			LM_ERR("failed to insert outbound Record-Route\n");
299 298
 			return -7;
300 299
 		}
301 300
 	}
... ...
@@ -303,12 +302,12 @@ int record_route(struct sip_msg* _m, str *params)
303 302
 	l = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, 0);
304 303
 	l2 = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, 0);
305 304
 	if (!l || !l2) {
306
-		LOG(L_ERR, "insert_RR(): Error while creating an anchor\n");
305
+		LM_ERR("failed to create an anchor\n");
307 306
 		return -3;
308 307
 	}
309 308
 	
310 309
 	if (build_rr(l, l2, &user, tag, params, INBOUND) < 0) {
311
-		LOG(L_ERR,"insert_RR(): Error while inserting inbound Record-Route\n");
310
+		LM_ERR("failed to insert inbound Record-Route\n");
312 311
 		return -4;
313 312
 	}
314 313
 
... ...
@@ -336,15 +335,14 @@ int record_route_preset(struct sip_msg* _m, str* _data)
336 335
 
337 336
 	if (add_username) {
338 337
 		if (get_username(_m, &user) < 0) {
339
-			LOG(L_ERR, "ERROR:rr:record_route_preset: failed to "
340
-				"extract username\n");
338
+			LM_ERR("failed to extract username\n");
341 339
 			return -1;
342 340
 		}
343 341
 	}
344 342
 
345 343
 	if (append_fromtag) {
346 344
 		if (parse_from_header(_m) < 0) {
347
-			LOG(L_ERR, "ERROR:rr:record_route_preset: From parsing failed\n");
345
+			LM_ERR("From parsing failed\n");
348 346
 			return -2;
349 347
 		}
350 348
 		from = (struct to_body*)_m->from->parsed;
... ...
@@ -352,8 +350,7 @@ int record_route_preset(struct sip_msg* _m, str* _data)
352 350
 	
353 351
 	l = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, 0);
354 352
 	if (!l) {
355
-		LOG(L_ERR, "ERROR:rr:record_route_preset: failed to create "
356
-			"lump anchor\n");
353
+		LM_ERR("failed to create lump anchor\n");
357 354
 		return -3;
358 355
 	}
359 356
 
... ...
@@ -376,7 +373,7 @@ int record_route_preset(struct sip_msg* _m, str* _data)
376 373
 
377 374
 	hdr = pkg_malloc(hdr_len);
378 375
 	if (!hdr) {
379
-		LOG(L_ERR, "ERROR:rr:record_route_preset: no pkg memory left\n");
376
+		LM_ERR("no pkg memory left\n");
380 377
 		return -4;
381 378
 	}
382 379
 
... ...
@@ -412,7 +409,7 @@ int record_route_preset(struct sip_msg* _m, str* _data)
412 409
 	memcpy(p, RR_TERM, RR_TERM_LEN);
413 410
 
414 411
 	if (!insert_new_lump_after(l, hdr, hdr_len, 0)) {
415
-		LOG(L_ERR, "record_route_preset(): Error while inserting new lump\n");
412
+		LM_ERR("failed to insert new lump\n");
416 413
 		pkg_free(hdr);
417 414
 		return -5;
418 415
 	}
... ...
@@ -450,18 +447,17 @@ int add_rr_param(struct sip_msg* msg, str* rr_param)
450 447
 	if (last_param) {
451 448
 		/* RR was already done -> have to add a new lump before this one */
452 449
 		if (insert_rr_param_lump( last_param, rr_param->s, rr_param->len)==0) {
453
-			LOG(L_ERR,"ERROR:rr:add_rr_param: failed to add lump\n");
450
+			LM_ERR("failed to add lump\n");
454 451
 			goto error;
455 452
 		}
456 453
 		/* double routing enabled? */
457 454
 		if (enable_double_rr) {
458 455
 			if (root==0 || (last_param=get_rr_param_lump(&root))==0) {
459
-				LOG(L_CRIT,"BUG:rr:add_rr_param: failed to locate "
460
-					"double RR lump\n");
456
+				LM_CRIT("failed to locate double RR lump\n");
461 457
 				goto error;
462 458
 			}
463 459
 			if (insert_rr_param_lump(last_param,rr_param->s,rr_param->len)==0){
464
-				LOG(L_ERR,"ERROR:rr:add_rr_param: failed to add 2nd lump\n");
460
+				LM_ERR("failed to add 2nd lump\n");
465 461
 				goto error;
466 462
 			}
467 463
 		}
... ...
@@ -473,14 +469,12 @@ int add_rr_param(struct sip_msg* msg, str* rr_param)
473 469
 			rr_param_msg = msg->id;
474 470
 		}
475 471
 		if (rr_param_buf.len+rr_param->len>RR_PARAM_BUF_SIZE) {
476
-			LOG(L_ERR,"ERROR:rr:add_rr_param: maximum size of "
477
-				"rr_param_buf exceeded\n");
472
+			LM_ERR("maximum size of rr_param_buf exceeded\n");
478 473
 			goto error;
479 474
 		}
480 475
 		memcpy( rr_param_buf.s+rr_param_buf.len, rr_param->s, rr_param->len);
481 476
 		rr_param_buf.len += rr_param->len;
482
-		DBG("DEBUG:rr:add_rr_param: rr_param_buf=<%.*s>\n",rr_param_buf.len,
483
-			rr_param_buf.s);
477
+		LM_DBG("rr_param_buf=<%.*s>\n",rr_param_buf.len, rr_param_buf.s);
484 478
 	}
485 479
 	return 0;
486 480
 
... ...
@@ -51,7 +51,7 @@ int register_rrcb( rr_cb_t f, void *param )
51 51
 
52 52
 	/* build a new callback structure */
53 53
 	if (!(cbp=pkg_malloc( sizeof( struct rr_callback)))) {
54
-		LOG(L_ERR, "ERROR:rr:register_rrcb: out of pkg. mem\n");
54
+		LM_ERR("no more pkg mem\n");
55 55
 		return -1;
56 56
 	}
57 57
 
... ...
@@ -78,7 +78,7 @@ void run_rr_callbacks( struct sip_msg *req, str *rr_params )
78 78
 
79 79
 	for ( cbp=rrcb_hl ; cbp ; cbp=cbp->next ) {
80 80
 		l_param = *rr_params;
81
-		DBG("DBG:rr:run_rr_callbacks: callback id %d entered with <%.*s>\n",
81
+		LM_DBG("callback id %d entered with <%.*s>\n",
82 82
 			cbp->id , l_param.len,l_param.s);
83 83
 		cbp->callback( req, &l_param, cbp->param );
84 84
 	}
... ...
@@ -137,7 +137,7 @@ struct module_exports exports = {
137 137
 
138 138
 static int mod_init(void)
139 139
 {
140
-	DBG("rr - initializing\n");
140
+	LM_DBG("rr - initializing\n");
141 141
 #ifdef ENABLE_USER_CHECK
142 142
 	if(ignore_user)
143 143
 	{
... ...
@@ -169,8 +169,7 @@ static int it_list_fixup(void** param, int param_no)
169 169
 		s.s = (char*)(*param); s.len = strlen(s.s);
170 170
 		if(pv_parse_format(&s, &model)<0)
171 171
 		{
172
-			LOG(L_ERR, "ERROR:textops:item_list_fixup: wrong format[%s]\n",
173
-				(char*)(*param));
172
+			LM_ERR("wrong format[%s]\n",(char*)(*param));
174 173
 			return E_UNSPEC;
175 174
 		}
176 175
 		*param = (void*)model;
... ...
@@ -185,8 +184,8 @@ static int direction_fixup(void** param, int param_no)
185 184
 	int n;
186 185
 
187 186
 	if (!append_fromtag) {
188
-		LOG(L_ERR,"ERROR:rr:direction_fixup: usage of \"is_direction\" function "
189
-			"requires parameter \"append_fromtag\" enabled!!");
187
+		LM_ERR("usage of \"is_direction\" function requires parameter"
188
+				"\"append_fromtag\" enabled!!");
190 189
 		return E_CFG;
191 190
 	}
192 191
 	if (param_no==1) {
... ...
@@ -197,7 +196,7 @@ static int direction_fixup(void** param, int param_no)
197 196
 		} else if ( strcasecmp(s,"upstream")==0 ) {
198 197
 			n = RR_FLOW_UPSTREAM;
199 198
 		} else {
200
-			LOG(L_ERR,"ERROR:rr:direction_fixup: unknown direction '%s'\n",s);
199
+			LM_ERR("unknown direction '%s'\n",s);
201 200
 			return E_CFG;
202 201
 		}
203 202
 		/* free string */
... ...
@@ -214,13 +213,12 @@ static int w_record_route(struct sip_msg *msg, char *key, char *bar)
214 213
 	str s;
215 214
 
216 215
 	if (msg->id == last_rr_msg) {
217
-		LOG(L_ERR, "ERROR:rr:record_route: Double attempt to record-route\n");
216
+		LM_ERR("Double attempt to record-route\n");
218 217
 		return -1;
219 218
 	}
220 219
 
221 220
 	if (key && pv_printf_s(msg, (pv_elem_t*)key, &s)<0) {
222
-		LOG(L_ERR,"ERROR:rr:w_record_route1: failed to print "
223
-			"the format\n");
221
+		LM_ERR("failed to print the format\n");
224 222
 		return -1;
225 223
 	}
226 224
 	if ( record_route( msg, key?&s:0 )<0 )
... ...
@@ -236,14 +234,12 @@ static int w_record_route_preset(struct sip_msg *msg, char *key, char *bar)
236 234
 	str s;
237 235
 
238 236
 	if (msg->id == last_rr_msg) {
239
-		LOG(L_ERR, "ERROR:rr:record_route_preset: Double attempt to "
240
-			"record-route\n");
237
+		LM_ERR("Duble attempt to record-route\n");
241 238
 		return -1;
242 239
 	}
243 240
 
244 241
 	if (pv_printf_s(msg, (pv_elem_t*)key, &s)<0) {
245
-		LOG(L_ERR,"ERROR:rr:w_record_route_preset: failed to print "
246
-			"the format\n");
242
+		LM_ERR("failed to print the format\n");
247 243
 		return -1;
248 244
 	}
249 245
 	if ( record_route_preset( msg, &s)<0 )
... ...
@@ -259,7 +255,7 @@ static int w_add_rr_param(struct sip_msg *msg, char *key, char *foo)
259 255
 	str s;
260 256
 
261 257
 	if (pv_printf_s(msg, (pv_elem_t*)key, &s)<0) {
262
-		LOG(L_ERR,"ERROR:rr:w_add_rr_param: failed to print the format\n");
258
+		LM_ERR("failed to print the format\n");
263 259
 		return -1;
264 260
 	}
265 261
 	return ((add_rr_param( msg, &s)==0)?1:-1);
... ...
@@ -65,16 +65,16 @@ int parse_cluster_cfg(void)
65 65
       while (*p!=' ' && *p!='\t' && *p!='[' && *p!=0)
66 66
 	 p++;
67 67
       if ( p==start || *p==0 ){
68
-	 LOG(L_ERR,"ERROR: cluster names must only contain alphanumeric chars\n");
68
+	 LM_ERR("cluster names must only contain alphanumeric chars\n");
69 69
 	 goto error;
70 70
       }
71 71
       if (!((*entry)=(struct as_entry*)shm_malloc(sizeof(struct as_entry)))) {
72
-	 LOG(L_ERR,"Out of shm mem for as_entry\n");
72
+	 LM_ERR("Out of shm mem for as_entry\n");
73 73
 	 goto error;
74 74
       }
75 75
       memset(*entry,0,sizeof(struct as_entry));
76 76
       if (!((*entry)->name.s=shm_malloc(p-start))) {
77
-	 LOG(L_ERR,"Out of shm malloc for cluster name\n");
77
+	 LM_ERR("Out of shm malloc for cluster name\n");
78 78
 	 goto error;
79 79
       }
80 80
       memcpy((*entry)->name.s, start, p-start);
... ...
@@ -85,7 +85,7 @@ int parse_cluster_cfg(void)
85 85
       /*get as names*/
86 86
       eat_spaces(p);
87 87
       if (*p!='['){
88
-	 LOG(L_ERR,"Malformed cluster cfg string %s\n",cluster_cfg);
88
+	 LM_ERR("Malformed cluster cfg string %s\n",cluster_cfg);
89 89
 	 goto error;
90 90
       }
91 91
       p++;
... ...
@@ -99,14 +99,14 @@ int parse_cluster_cfg(void)
99 99
 	 if ( p==start || *p==0 )
100 100
 	    goto error;
101 101
 	 if (!((*entry)->u.cs.as_names[n].s=shm_malloc(p-start))) {
102
-	    LOG(L_ERR,"Out of shm_mem for AS name in cluster\n");
102
+	    LM_ERR("Out of shm_mem for AS name in cluster\n");
103 103
 	    goto error;
104 104
 	 }
105 105
 	 (*entry)->u.cs.as_names[n].len=p-start;
106 106
 	 memcpy((*entry)->u.cs.as_names[n].s,start,p-start);
107 107
 	 n++;
108 108
 	 if(n>=MAX_AS_PER_CLUSTER){
109
-	    LOG(L_ERR,"ERROR: too many AS per cluster\n");
109
+	    LM_ERR("too many AS per cluster\n");
110 110
 	    goto error;
111 111
 	 }
112 112
 	 eat_spaces(p);
... ...
@@ -125,16 +125,16 @@ int parse_cluster_cfg(void)
125 125
       entry=&((*entry)->next);
126 126
    }
127 127
    for (tmp=as_list;tmp->next;tmp=tmp->next){
128
-      LOG(L_DBG,"%.*s\n",tmp->name.len,tmp->name.s);
128
+      LM_DBG("%.*s\n",tmp->name.len,tmp->name.s);
129 129
    }
130
-   LOG(L_DBG,"%.*s\n",tmp->name.len,tmp->name.s);
130
+   LM_DBG("%.*s\n",tmp->name.len,tmp->name.s);
131 131
    entry=&(tmp->next);
132 132
    for(tmp=as_list;tmp;tmp=tmp->next){
133 133
       if (tmp->type!=CLUSTER_TYPE) 
134 134
 	 continue;
135
-      LOG(L_DBG,"cluster:[%.*s]\n",tmp->name.len,tmp->name.s);
135
+      LM_DBG("cluster:[%.*s]\n",tmp->name.len,tmp->name.s);
136 136
       for(k=0;k<tmp->u.cs.num;k++){
137
-	 LOG(L_DBG,"\tAS:[%.*s]\n",tmp->u.cs.as_names[k].len,tmp->u.cs.as_names[k].s);
137
+	 LM_DBG("\tAS:[%.*s]\n",tmp->u.cs.as_names[k].len,tmp->u.cs.as_names[k].s);
138 138
 	 for (tmp2=as_list;tmp2;tmp2=tmp2->next) {
139 139
 	    if (tmp2->type== AS_TYPE && tmp->u.cs.as_names[k].len == tmp2->name.len && 
140 140
 		  !memcmp(tmp->u.cs.as_names[k].s,tmp2->name.s,tmp2->name.len)) {
... ...
@@ -145,13 +145,13 @@ int parse_cluster_cfg(void)
145 145
 	 if(tmp2)
146 146
 	    continue;
147 147
 	 if (!((*entry)=shm_malloc(sizeof(struct as_entry)))) {
148
-	    LOG(L_ERR,"ERROR:Out of shm mem \n");
148
+	    LM_ERR("Out of shm mem \n");
149 149
 	    goto error;
150 150
 	 }
151 151
 	 memset(*entry,0,sizeof(struct as_entry));
152 152
 	 (*entry)->type=AS_TYPE;
153 153
 	 if (!((*entry)->name.s=shm_malloc(tmp->u.cs.as_names[k].len))) {
154
-	    LOG(L_ERR,"ERROR:out of shm mem\n");
154
+	    LM_ERR("out of shm mem\n");
155 155
 	    goto error;
156 156
 	 }
157 157
 	 memcpy((*entry)->name.s,tmp->u.cs.as_names[k].s,tmp->u.cs.as_names[k].len);
... ...
@@ -162,7 +162,7 @@ int parse_cluster_cfg(void)
162 162
       }
163 163
    }
164 164
    for(tmp=as_list;tmp;tmp=tmp->next){
165
-      LOG(L_DBG,"%.*s %s",tmp->name.len,tmp->name.s,tmp->next?"":"\n");
165
+      LM_DBG("%.*s %s",tmp->name.len,tmp->name.s,tmp->next?"":"\n");
166 166
    }
167 167
    return 1;
168 168
 error:
... ...
@@ -77,7 +77,7 @@ int encode_contact_body(char *hdr,int hdrlen,contact_body_t *contact_parsed,unsi
77 77
    }
78 78
    for(contact_offset=0,i=0,mycontact=contact_parsed->contacts;mycontact;mycontact=mycontact->next,i++){
79 79
       if((k=encode_contact(hdr,hdrlen,mycontact,&tmp[contact_offset]))<0){
80
-	 LOG(L_ERR,"parsing contact number %d\n",i);
80
+	 LM_ERR("parsing contact number %d\n",i);
81 81
 	 return -1;
82 82
       }
83 83
       where[2+i]=k;
... ...
@@ -140,11 +140,11 @@ int encode_contact(char *hdrstart,int hdrlen,contact_t *body,unsigned char *wher
140 140
    }
141 141
 
142 142
    if (parse_uri(body->uri.s, body->uri.len,&puri) < 0 ) {
143
-      LOG(L_ERR, "Bad URI in address\n");
143
+      LM_ERR("Bad URI in address\n");
144 144
       return -1;
145 145
    }else{
146 146
       if((j=encode_uri2(hdrstart,hdrlen,body->uri,&puri,&where[i]))<0){
147
-	 LOG(L_ERR, "error codifying the URI\n");
147
+	 LM_ERR("failed to codify the URI\n");
148 148
 	 return -1;
149 149
       }else{
150 150
 	 i+=j;
... ...
@@ -175,7 +175,7 @@ int print_encoded_contact_body(int fd,char *hdr,int hdrlen,unsigned char *payloa
175 175
    }
176 176
    numcontacts=payload[1];
177 177
    if(numcontacts==0){
178
-      LOG(L_ERR,"no contacts present?\n");
178
+      LM_ERR("no contacts present?\n");
179 179
       return -1;
180 180
    }
181 181
    for(i=0,offset=2+numcontacts;i<numcontacts;i++){
... ...
@@ -245,7 +245,7 @@ int dump_contact_body_test(char *hdr,int hdrlen,unsigned char *payload,int payle
245 245
    }
246 246
    numcontacts=payload[1];
247 247
    if(numcontacts==0){
248
-      LOG(L_ERR,"no contacts present?\n");
248
+      LM_ERR("no contacts present?\n");
249 249
       return -1;
250 250
    }
251 251
    if(segregationLevel & (JUNIT|SEGREGATE|ONLY_URIS)){
... ...
@@ -69,7 +69,7 @@ int encode_cseq(char *hdrstart,int hdrlen,struct cseq_body *body,unsigned char *
69 69
       i++;
70 70
    where[0]=i;
71 71
    if(str2int(&body->number,&cseqnum)<0){
72
-      LOG(L_ERR,"str2int(cseq number)\n");
72
+      LM_ERR("str2int(cseq number)\n");
73 73
       return -1;
74 74
    }
75 75
    cseqnum=htonl(cseqnum);
... ...
@@ -104,11 +104,11 @@ int encode_digest(char *hdrstart,int hdrlen,dig_cred_t *digest,unsigned char *wh
104 104
       memset(&sipuri,0,sizeof(struct sip_uri));
105 105
       flags1|=HAS_URI_F;
106 106
       if (parse_uri(digest->uri.s, digest->uri.len,&sipuri) < 0 ) {
107
-	 LOG(L_ERR, "Bad URI in address\n");
107
+	 LM_ERR("Bad URI in address\n");
108 108
 	 return -1;
109 109
       }else{
110 110
 	 if((j=encode_uri2(hdrstart,hdrlen,digest->uri,&sipuri,&where[i+1]))<0){
111
-	    LOG(L_ERR, "Error encoding the URI\n");
111
+	    LM_ERR("Error encoding the URI\n");
112 112
 	    return -1;
113 113
 	 }else{
114 114
 	    where[i]=(unsigned char)j;
... ...
@@ -104,16 +104,17 @@ int encode_header(struct sip_msg *sipmsg,struct hdr_field *hdr,unsigned char *pa
104 104
    mlen=sipmsg->len;
105 105
    hdrstart = hdr->name.s;
106 106
    if(hdrstart-msg<0){
107
-      LOG(L_ERR,"header(%.*s) does not belong to sip_msg(hdrstart<msg)\n",hdr->name.len,hdr->name.s);
107
+      LM_ERR("header(%.*s) does not belong to sip_msg(hdrstart<msg)\n",
108
+			  hdr->name.len,hdr->name.s);
108 109
       return -1;
109 110
    }
110 111
    ptr=htons((short int)(hdrstart-msg));
111 112
    if((hdrstart-msg)>mlen){
112
-      LOG(L_ERR,"out of the sip_msg bounds (%d>%d)\n",ntohs(ptr),mlen);
113
+      LM_ERR("out of the sip_msg bounds (%d>%d)\n",ntohs(ptr),mlen);
113 114
       return -1;
114 115
    }
115 116
    if(hdr->len>(1<<16)){
116
-      LOG(L_ERR,"length of header too long\n");
117
+      LM_ERR("length of header too long\n");
117 118
       return -1;
118 119
    }
119 120
    memcpy(payload,&ptr,2);
... ...
@@ -322,7 +323,7 @@ error:
322 323
       free_via_list(viabody);
323 324
    if(methods)
324 325
       pkg_free(methods);
325
-   LOG(L_ERR,"%s",myerror);
326
+   LM_ERR("%s",myerror);
326 327
    return -1;
327 328
 }
328 329
 
... ...
@@ -214,7 +214,7 @@ int encode_msg(struct sip_msg *msg,char *payload,int len)
214 214
 	 (ms->u.reply.version.s-msg->buf));
215 215
    if(request){
216 216
       if (parse_uri(ms->u.request.uri.s,ms->u.request.uri.len, &miuri)<0){
217
-	 LOG(L_ERR, "<%.*s>\n",ms->u.request.uri.len,ms->u.request.uri.s);
217
+	 LM_ERR("<%.*s>\n",ms->u.request.uri.len,ms->u.request.uri.s);
218 218
 	 myerror="while parsing the R-URI";
219 219
 	 goto error;
220 220
       }
... ...
@@ -243,7 +243,7 @@ int encode_msg(struct sip_msg *msg,char *payload,int len)
243 243
       memcpy(&payload[k+1],&h,2);
244 244
       /*TODO fix this... fixed with k-=3?*/
245 245
       if(0>(i=encode_header(msg,hf,(unsigned char*)(payload+j),MAX_ENCODED_MSG+MAX_MESSAGE_LEN-j))){
246
-	 LOG(L_ERR,"encoding header %.*s\n",hf->name.len,hf->name.s);
246
+	 LM_ERR("encoding header %.*s\n",hf->name.len,hf->name.s);
247 247
 	 goto error;
248 248
 	 k-=3;
249 249
 	 continue;
... ...
@@ -267,13 +267,13 @@ int encode_msg(struct sip_msg *msg,char *payload,int len)
267 267
    /*pkg_free(payload2);*/
268 268
    /*now we copy the actual message after the headers-meta-section*/
269 269
    memcpy(&payload[j],msg->buf,msg->len);
270
-   LOG(L_DBG,"msglen = %d,msg starts at %d\n",msg->len,j);
270
+   LM_DBG("msglen = %d,msg starts at %d\n",msg->len,j);
271 271
    j=htons(j);
272 272
    /*now we copy at the beginning, the index to where the actual message starts*/
273 273
    memcpy(&payload[MSG_START_IDX],&j,2);
274 274
    return GET_PAY_SIZE( payload );
275 275
 error:
276
-   LOG(L_ERR,"%s\n",myerror);
276
+   LM_ERR("%s\n",myerror);
277 277
    return -1;
278 278
 }
279 279
 
... ...
@@ -295,7 +295,7 @@ int decode_msg(struct sip_msg *msg,char *code, unsigned int len)
295 295
       goto error;
296 296
    }
297 297
 error:
298
-   LOG(L_ERR,"(%s)\n",myerror);
298
+   LM_ERR("(%s)\n",myerror);
299 299
    return -1;
300 300
 }
301 301
 
... ...
@@ -72,7 +72,7 @@ int encode_route_body(char *hdr,int hdrlen,rr_t *route_parsed,unsigned char *whe
72 72
    flags=0;
73 73
    for(route_offset=0,i=0,myroute=route_parsed;myroute;myroute=myroute->next,i++){
74 74
       if((k=encode_route(hdr,hdrlen,myroute,&tmp[route_offset]))<0){
75
-	 LOG(L_ERR,"parsing route number %d\n",i);
75
+	 LM_ERR("parsing route number %d\n",i);
76 76
 	 return -1;
77 77
       }
78 78
       where[2+i]=(unsigned char)k;
... ...
@@ -108,11 +108,11 @@ int encode_route(char *hdrstart,int hdrlen,rr_t *body,unsigned char *where)
108 108
    }
109 109
 
110 110
    if (parse_uri(body->nameaddr.uri.s, body->nameaddr.uri.len,&puri) < 0 ) {
111
-      LOG(L_ERR, "Bad URI in address\n");
112
-      return -1;
111
+      LM_ERR("Bad URI in address\n");
112
+	  return -1;
113 113
    }else{
114 114
       if((j=encode_uri2(hdrstart,hdrlen,body->nameaddr.uri,&puri,&where[i]))<0){
115
-	 LOG(L_ERR, "error codifying the URI\n");
115
+	 LM_ERR("error codifying the URI\n");
116 116
 	 return -1;
117 117
       }else{
118 118
 	 i+=j;
... ...
@@ -137,7 +137,7 @@ int print_encoded_route_body(int fd,char *hdr,int hdrlen,unsigned char *payload,
137 137
 
138 138
    numroutes=payload[1];
139 139
    if(numroutes==0){
140
-      LOG(L_ERR,"no routes present?\n");
140
+      LM_ERR("no routes present?\n");
141 141
       return -1;
142 142
    }
143 143
    for(i=0,offset=2+numroutes;i<numroutes;i++){
... ...
@@ -189,7 +189,7 @@ int dump_route_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,
189 189
 
190 190
    numroutes=payload[1];
191 191
    if(numroutes==0){
192
-      LOG(L_ERR,"no routes present?\n");
192
+      LM_ERR("no routes present?\n");
193 193
       return -1;
194 194
    }
195 195
    if(segregationLevel & (JUNIT|SEGREGATE|ONLY_URIS)){
... ...
@@ -86,11 +86,11 @@ int encode_to_body(char *hdrstart,int hdrlen,struct to_body *body,unsigned char
86 86
       where[i++]=(unsigned char)body->tag_value.len;
87 87
    }
88 88
    if (parse_uri(body->uri.s, body->uri.len,&puri) < 0 ) {
89
-      LOG(L_ERR, "Bad URI in address\n");
89
+      LM_ERR("Bad URI in address\n");
90 90
       return -1;
91 91
    }else{
92 92
       if((j=encode_uri2(hdrstart,hdrlen,body->uri,&puri,&where[i]))<0){
93
-	 LOG(L_ERR, "error codifying the URI\n");
93
+	 LM_ERR("failed to codify the URI\n");
94 94
 	 return -1;
95 95
       }else{
96 96
 	 i+=j;
... ...
@@ -121,7 +121,7 @@ int encode_uri2(char *hdr,int hdrlen,str uri_str, struct sip_uri *uri_parsed,uns
121 121
 
122 122
    uriptr=REL_PTR(hdr,uri_str.s);
123 123
    if(uri_str.len>255 || uriptr>hdrlen){
124
-      LOG(L_ERR,"uri too long, or out of the sip_msg bounds\n");
124
+      LM_ERR("uri too long, or out of the sip_msg bounds\n");
125 125
       return -1;
126 126
    }
127 127
    payload[0]=uriptr;
... ...
@@ -76,7 +76,7 @@ int encode_via_body(char *hdr,int hdrlen,struct via_body *via_parsed,unsigned ch
76 76
    if(via_parsed)
77 77
       for(via_offset=0,i=0,myvia=via_parsed;myvia;myvia=myvia->next,i++){
78 78
 	 if((k=encode_via(hdr,hdrlen,myvia,&tmp[via_offset]))<0){
79
-	    LOG(L_ERR,"parsing via number %d\n",i);
79
+	    LM_ERR("failed to parse via number %d\n",i);
80 80
 	    return -1;
81 81
 	 }
82 82
 	 where[2+i]=(unsigned char)k;
... ...
@@ -162,7 +162,7 @@ int print_encoded_via_body(int fd,char *hdr,int hdrlen,unsigned char *payload,in
162 162
    numvias=payload[1];
163 163
    dprintf(fd,"%s%d","NUMBER OF VIAS:",numvias);
164 164
    if(numvias==0){
165
-      LOG(L_ERR,"no vias present?\n");
165
+      LM_ERR("no vias present?\n");
166 166
       return -1;
167 167
    }
168 168
    for(i=0,offset=2+numvias;i<numvias;i++){
... ...
@@ -237,7 +237,7 @@ int dump_via_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,in
237 237
 
238 238
    numvias=payload[1];
239 239
    if(numvias==0){
240
-      LOG(L_ERR,"no vias present?\n");
240
+      LM_ERR("no vias present?\n");
241 241
       return -1;
242 242
    }
243 243
    if(segregationLevel & SEGREGATE)
... ...
@@ -36,7 +36,7 @@
36 36
 #include "../../hash_func.h" /*T_TABLE_POWER*/
37 37
 #include "../../mem/mem.h" /*pkg_malloc*/
38 38
 #include "../../mem/shm_mem.h" /*shm_malloc*/
39
-#include "../../dprint.h" /*LOG*/
39
+#include "../../dprint.h" /*LM_**/
40 40
 #include "../../locking.h"
41 41
 
42 42
 #include "seas.h"
... ...
@@ -106,11 +106,11 @@ int dispatcher_main_loop(void)
106 106
 
107 107
    strcpy(whoami,"Seas Event Dispatcher process");
108 108
    /*I set process_no to -1 because otherwise, the logging process confuses this process with another from SER
109
-    * (see LOG() and dprint() and my_pid())*/
109
+    * (see LM_*() and dprint() and my_pid())*/
110 110
    process_no = -1;
111 111
 
112 112
    if(open_server_sockets(seas_listen_ip,seas_listen_port,socks)==-1){
113
-      LOG(L_ERR,"unable to open server sockets on dispatcher\n");
113
+      LM_ERR("unable to open server sockets on dispatcher\n");
114 114
       return -1;
115 115
    }
116 116
    for(i=0;i<2;i++){
... ...
@@ -132,11 +132,14 @@ int dispatcher_main_loop(void)
132 132
       if(sig_flag==SIGCHLD){
133 133
 	 while ((chld=waitpid( -1, &chld_status, WNOHANG ))>0) {
134 134
 	    if (WIFEXITED(chld_status)){
135
-	       LOG(L_INFO, "child process %d exited normally, status=%d\n",chld,WEXITSTATUS(chld_status));
135
+	       LM_INFO("child process %d exited normally, status=%d\n",
136
+				   chld,WEXITSTATUS(chld_status));
136 137
 	    }else if (WIFSIGNALED(chld_status)) {
137
-	       LOG(L_INFO, "child process %d exited by a signal %d\n",chld,WTERMSIG(chld_status));
138
+	       LM_INFO("child process %d exited by a signal %d\n",
139
+				   chld,WTERMSIG(chld_status));
138 140
 	    }else if (WIFSTOPPED(chld_status)) 
139
-	       LOG(L_INFO, "child process %d stopped by a signal %d\n",chld,WSTOPSIG(chld_status));
141
+	       LM_INFO("child process %d stopped by a signal %d\n",
142
+				   chld,WSTOPSIG(chld_status));
140 143
 	    for (as=as_list;as;as=as->next) {
141 144
 	       if(as->type!=AS_TYPE)
142 145
 		  continue;
... ...
@@ -144,7 +147,7 @@ int dispatcher_main_loop(void)
144 147
 		  for(i=0;i<as_nr && ((poll_fds[3+i].fd)!=(as->u.as.event_fd));i++)
145 148
 		     ;
146 149
 		  if(i==as_nr){
147
-		     LOG(L_ERR,"Either the pinger has died or BUG found..\n");
150
+		     LM_ERR("Either the pinger has died or BUG found..\n");
148 151
 		     continue;
149 152
 		  }
150 153
 		  /*overwrite the obsolete 'i' position with the next position*/
... ...
@@ -164,17 +167,19 @@ int dispatcher_main_loop(void)
164 167
 		  destroy_pingtable(&as->u.as.jain_pings);
165 168
 		  destroy_pingtable(&as->u.as.servlet_pings);
166 169
 		  as_nr--;
167
-		  LOG(L_WARN,"client [%.*s] leaving (Action Dispatcher Process died !)\n",as->name.len,as->name.s);
170
+		  LM_WARN("client [%.*s] leaving (Action Dispatcher Process died !)\n",
171
+				  as->name.len,as->name.s);
168 172
 		  break;
169 173
 	       }/*if(action_pid==chld)*/
170 174
 	    }/*for(as=as_list;as;as=as->next)*/
171 175
 	 }/*while(waitpid(-1)>0)*/
172 176
       }else if (sig_flag) {
173
-	 LOG(L_WARN,"received signal != sigchld(%d)\n",sig_flag);
174
-      }
177
+	 LM_WARN("received signal != sigchld(%d)\n",sig_flag);
178
+	  }
175 179
       sig_flag=0;
176 180
       clean_index=0;
177
-      LOG(L_INFO,"polling [2 ServSock] [1 pipe] [%d App Servers] [%d Uncomplete AS]\n",as_nr,unc_as_nr);
181
+      LM_INFO("polling [2 ServSock] [1 pipe] [%d App Servers]"
182
+			  " [%d Uncomplete AS]\n",as_nr,unc_as_nr);
178 183
       poll_events = poll(poll_fds,3+unc_as_nr+as_nr,-1);
179 184
       if (poll_events == -1) {
180 185
 	 if(errno==EINTR){
... ...
@@ -183,11 +188,12 @@ int dispatcher_main_loop(void)
183 188
 	    continue;
184 189
 	 }
185 190
 	 if(errno==EBADF){
186
-	    LOG(L_ERR, "invalid file descriptor pased to poll (%s)\n",strerror(errno));
191
+	    LM_ERR("invalid file descriptor pased to poll (%s)\n",
192
+				strerror(errno));
187 193
 	    return -1;/*??*/
188 194
 	 }
189 195
 	 /* errors */
190
-	 LOG(L_ERR,"poll'ing:%s\n",strerror(errno));
196
+	 LM_ERR("poll'ing:%s\n",strerror(errno));
191 197
 	 poll_events=0;
192 198
 	 continue;
193 199
       } else if (poll_events == 0) {/*timeout*/
... ...
@@ -204,9 +210,9 @@ int dispatcher_main_loop(void)
204 210
 		  poll_tmp->fd=fd;
205 211
 		  poll_tmp->events=POLLIN|POLLHUP;
206 212
 		  unc_as_nr++;
207
-		  LOG(L_DBG,"Have new %s client\n",i==0?"event":"action");
213
+		  LM_DBG("Have new %s client\n",i==0?"event":"action");
208 214
 	       }else{
209
-		  LOG(L_ERR,"accepting connection from AS\n");
215
+		  LM_ERR("accepting connection from AS\n");
210 216
 	       }
211 217
 	    }
212 218
 	 }
... ...
@@ -215,36 +221,36 @@ int dispatcher_main_loop(void)
215 221
 	    poll_fds[2].revents &= (~POLLIN);
216 222
 	    poll_events--;
217 223
 	    if(dispatch_relay()<0){
218
-	       LOG(L_ERR,"dispatch_relay returned -1"
224
+	       LM_ERR("dispatch_relay returned -1"
219 225
 		     "should clean-up table\n");
220 226
 	    }
221 227
 	 }
222 228
 	 /*now handle receive data from completed AS*/
223 229
 	 clean_index=0;
224
-	 LOG(L_DBG,"Scanning data from %d AS\n",as_nr);
230
+	 LM_DBG("Scanning data from %d AS\n",as_nr);
225 231
 	 for(i=0;(i<as_nr) && poll_events;i++){
226 232
 	    clean_index=0;
227 233
 	    poll_tmp=&poll_fds[3+i];
228 234
 	    if(poll_tmp->revents)
229 235
 	       poll_events--;
230 236
 	    if(poll_tmp->revents & POLLIN){
231
-	       LOG(L_DBG,"POLLIN found in AS #%i\n",i);
237
+	       LM_DBG("POLLIN found in AS #%i\n",i);
232 238
 	       poll_tmp->revents &= (~POLLIN);
233 239
 	       switch(handle_as_data(poll_tmp->fd)){
234 240
 		  case -2:/*read returned 0 bytes, an AS client is leaving*/
235 241
 		     clean_index=1;
236 242
 		     break;
237 243
 		  case -1:/*shouldnt happen*/
238
-		     LOG(L_ERR,"reading from AS socket\n");
244
+		     LM_ERR("reading from AS socket\n");
239 245
 		     break;
240 246
 		  case 0:/* event_response received and processed*/
241 247
 		     break;
242 248
 		  default:
243
-		     LOG(L_WARN,"unknown return type from handle_as_data\n");
249
+		     LM_WARN("unknown return type from handle_as_data\n");
244 250
 	       }
245 251
 	    }
246 252
 	    if(clean_index || (poll_tmp->revents & POLLHUP)){
247
-	       LOG(L_DBG,"POLHUP or read==0 found in %i AS \n",i);
253
+	       LM_DBG("POLHUP or read==0 found in %i AS \n",i);
248 254
 	       clean_index=0;
249 255
 	       poll_tmp->revents = 0;
250 256
 	       for(as=as_list;as;as=as->next){
... ...
@@ -263,24 +269,24 @@ int dispatcher_main_loop(void)
263 269
 			poll_fds[j].revents=poll_fds[j+1].revents;
264 270
 		     }
265 271
 		     --i;
266
-		     LOG(L_WARN,"client %.*s leaving !!!\n",as->name.len,as->name.s);
272
+		     LM_WARN("client %.*s leaving !!!\n",as->name.len,as->name.s);
267 273
 		     break;
268 274
 		  }
269 275
 	       }
270 276
 	       if (!as) {
271
-		  LOG(L_ERR,"the leaving client was not found in the as_list\n");
272
-	       }
277
+		  LM_ERR("the leaving client was not found in the as_list\n");
278
+		   }
273 279
 	    }
274 280
 	 }
275 281
 	 /*now handle data sent from uncompleted AS*/
276
-	 LOG(L_DBG,"Scanning data from %d uncomplete AS \n",unc_as_nr);
282
+	 LM_DBG("Scanning data from %d uncomplete AS \n",unc_as_nr);
277 283
 	 clean_index=0;
278 284
 	 for(i=0;i<unc_as_nr && poll_events;i++){
279 285
 	    poll_tmp=&poll_fds[3+as_nr+i];
280 286
 	    if(poll_tmp->revents)
281 287
 	       poll_events--;
282 288
 	    if(poll_tmp->revents & POLLIN){
283
-	       LOG(L_DBG,"POLLIN found in %d uncomplete AS \n",i);
289
+	       LM_DBG("POLLIN found in %d uncomplete AS \n",i);
284 290
 	       poll_tmp->revents &= (~POLLIN);
285 291
 	       fd=handle_unc_as_data(poll_tmp->fd);
286 292
 	       if(fd>0){
... ...
@@ -311,7 +317,7 @@ int dispatcher_main_loop(void)
311 317
 	       }
312 318
 	    }
313 319
 	    if(poll_tmp->revents & POLLHUP){
314
-	       LOG(L_DBG,"POLLHUP found in %d uncomplete AS \n",i);
320
+	       LM_DBG("POLLHUP found in %d uncomplete AS \n",i);
315 321
 	       close(poll_tmp->fd);
316 322
 	       for(k=i;k<(unc_as_nr-1);k++){
317 323
 		  j=3+as_nr+k;
... ...
@@ -354,30 +360,30 @@ static int open_server_sockets(struct ip_addr *address,unsigned short port,int *
354 360
    fd[0]=fd[1]=-1;
355 361
 
356 362
    if(address->af!=AF_INET && address->af!=AF_INET6){
357
-      LOG(L_ERR,"Only ip and ipv6 allowed socket types\n");
363
+      LM_ERR("Only ip and ipv6 allowed socket types\n");
358 364
       return -1;
359 365
    }
360 366
 
361 367
    for(i=0;i<2;i++){
362 368
       if(init_su(&su,address,port+i)<0){
363
-	 LOG(L_ERR,"unable to init sockaddr_union\n");
369
+	 LM_ERR("unable to init sockaddr_union\n");
364 370
 	 return -1;
365 371
       }
366 372
       if((fd[i]=socket(AF2PF(su.s.sa_family), SOCK_STREAM, 0))==-1){
367
-	 LOG(L_ERR,"trying to open server %s socket (%s)\n",i==0?"event":"action",strerror(errno));
373
+	 LM_ERR("trying to open server %s socket (%s)\n",i==0?"event":"action",strerror(errno));
368 374
 	 goto error;
369 375
       }
370 376
       optval=1;
371 377
       if (setsockopt(fd[i], SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(optval))==-1) {
372
-	 LOG(L_ERR,"setsockopt (%s)\n",strerror(errno));
378
+	 LM_ERR("setsockopt (%s)\n",strerror(errno));
373 379
 	 goto error;
374 380
       }
375 381
       if ((bind(fd[i], &su.s,sizeof(union sockaddr_union)))==-1){
376
-	 LOG(L_ERR, "bind (%s)\n",strerror(errno));
382
+	 LM_ERR( "bind (%s)\n",strerror(errno));
377 383
 	 goto error;
378 384
       }
379 385
       if (listen(fd[i], 10)==-1){
380
-	 LOG(L_ERR, "listen (%s)\n",strerror(errno));
386
+	 LM_ERR( "listen (%s)\n",strerror(errno));
381 387
 	 goto error;
382 388
       }
383 389
    }
... ...
@@ -422,13 +428,13 @@ read_again:
422 428
       if(errno==EINTR){
423 429
 	 goto read_again;
424 430
       }else{
425
-	 LOG(L_ERR,"Dispatcher Process "
426
-	       "received unknown error reading from pipe (%s)\n",strerror(errno));
431
+	 LM_ERR("Dispatcher Process received unknown error"
432
+			 " reading from pipe (%s)\n",strerror(errno));
427 433
 	 retval=-1;
428 434
 	 goto error;
429 435
       }
430 436
    }else if(i==0){
431
-	 LOG(L_ERR,"Dispatcher Process "
437
+	 LM_ERR("Dispatcher Process "
432 438
 	       "received 0 while reading from pipe\n");
433 439
 	 goto error;
434 440
    }else{
... ...
@@ -438,7 +444,7 @@ read_again:
438 444
    }
439 445
 
440 446
    if (!thepointer.ptr) {
441
-      LOG(L_ERR,"Received Corrupted pointer to event !!\n");
447
+      LM_ERR("Received Corrupted pointer to event !!\n");
442 448
       retval=0;
443 449
       goto error;
444 450
    }
... ...
@@ -446,7 +452,8 @@ read_again:
446 452
    if(use_stats && thepointer.ptr->transaction)
447 453
       event_stat(thepointer.ptr->transaction);
448 454
    if(thepointer.ptr->as == NULL || !thepointer.ptr->as->connected || thepointer.ptr->as->type==CLUSTER_TYPE){
449
-      LOG(L_WARN,"tryied to send an event to an App Server that is scheduled to die !!\n");
455
+      LM_WARN("tryied to send an event to an App Server"
456
+			  " that is scheduled to die!!\n");
450 457
       retval=-2;
451 458
       goto error;
452 459
    }
... ...
@@ -458,19 +465,20 @@ write_again:
458 465
       switch(errno){
459 466
 	 case EINTR:
460 467
 	    if(!thepointer.ptr->as->connected){
461
-	       LOG(L_WARN,"tryied to send an event to an App Server that is scheduled to die !!\n");
468
+	       LM_WARN("tryied to send an event to an App Server"
469
+				   " that is scheduled to die!!\n");
462 470
 	       retval=-2;
463 471
 	       goto error;
464 472
 	    }
465