Browse code

-more modules migrated to LM_* logging format

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

Bogdan-Andrei Iancu authored on 20/09/2007 07:47:17
Showing 75 changed files
... ...
@@ -120,7 +120,7 @@ static inline int core2strar( struct sip_msg *req, str *c_vals)
120 120
 
121 121
 	/* from/to URI and TAG */
122 122
 	if (req->msg_flags&FL_REQ_UPSTREAM) {
123
-		DBG("DBUG:acc:core2strar: UPSTREAM flag set -> swap F/T\n"); \
123
+		LM_DBG("the flag UPSTREAM is set -> swap F/T\n"); \
124 124
 		from = acc_env.to;
125 125
 		to = req->from;
126 126
 	} else {
... ...
@@ -212,8 +212,7 @@ int acc_log_request( struct sip_msg *rq)
212 212
 
213 213
 	for ( i=0,p=log_msg ; i<m ; i++ ) {
214 214
 		if (p+1+log_attrs[i].len+1+val_arr[i].len >= log_msg_end) {
215
-			LOG(L_WARN,"WARNING:acc:acc_log_request: acc message too long,"
216
-				" truncating..\n");
215
+			LM_WARN("acc message too long, truncating..\n");
217 216
 			p = log_msg_end;
218 217
 			break;
219 218
 		}
... ...
@@ -231,8 +230,7 @@ int acc_log_request( struct sip_msg *rq)
231 231
 		do {
232 232
 			for (i=m; i<m+n; i++) {
233 233
 				if (p+1+log_attrs[i].len+1+val_arr[i].len >= log_msg_end) {
234
-					LOG(L_WARN,"WARNING:acc:acc_log_request: acc message too "
235
-						"long, truncating..\n");
234
+					LM_WARN("acc message too long, truncating..\n");
236 235
 					p = log_msg_end;
237 236
 					break;
238 237
 				}
... ...
@@ -309,14 +307,13 @@ static void acc_db_init_keys(void)
309 309
 int acc_db_init(char* db_url)
310 310
 {
311 311
 	if (bind_dbmod(db_url, &acc_dbf)<0){
312
-		LOG(L_ERR, "ERROR:acc:acc_db_init: bind_db failed\n");
312
+		LM_ERR("bind_db failed\n");
313 313
 		return -1;
314 314
 	}
315 315
 
316 316
 	/* Check database capabilities */
317 317
 	if (!DB_CAPABILITY(acc_dbf, DB_CAP_INSERT)) {
318
-		LOG(L_ERR, "ERROR:acc:acc_db_init: Database module does not "
319
-			"implement insert function\n");
318
+		LM_ERR("database module does not implement insert function\n");
320 319
 		return -1;
321 320
 	}
322 321
 
... ...
@@ -332,8 +329,7 @@ int acc_db_init_child(char *db_url)
332 332
 {
333 333
 	db_handle=acc_dbf.init(db_url);
334 334
 	if (db_handle==0){
335
-		LOG(L_ERR, "ERROR:acc:acc_db_init: unable to connect to the "
336
-				"database\n");
335
+		LM_ERR("unable to connect to the database\n");
337 336
 		return -1;
338 337
 	}
339 338
 	return 0;
... ...
@@ -369,15 +365,14 @@ int acc_db_request( struct sip_msg *rq)
369 369
 		VAL_STR(db_vals+i) = val_arr[i];
370 370
 
371 371
 	if (acc_dbf.use_table(db_handle, acc_env.text.s/*table*/) < 0) {
372
-		LOG(L_ERR, "ERROR:acc:acc_db_request: Error in use_table\n");
372
+		LM_ERR("error in use_table\n");
373 373
 		return -1;
374 374
 	}
375 375
 
376 376
 	/* multi-leg columns */
377 377
 	if ( !leg_info ) {
378 378
 		if (acc_dbf.insert(db_handle, db_keys, db_vals, m) < 0) {
379
-			LOG(L_ERR, "ERROR:acc:acc_db_request: "
380
-					"Error while inserting to database\n");
379
+			LM_ERR("failed to insert into database\n");
381 380
 			return -1;
382 381
 		}
383 382
 	} else {
... ...
@@ -386,8 +381,7 @@ int acc_db_request( struct sip_msg *rq)
386 386
 			for (i=m; i<m+n; i++)
387 387
 				VAL_STR(db_vals+i)=val_arr[i];
388 388
 			if (acc_dbf.insert(db_handle, db_keys, db_vals, m+n) < 0) {
389
-				LOG(L_ERR, "ERROR:acc:acc_db_request: "
390
-					"Error while inserting to database\n");
389
+				LM_ERR("failed to insert into database\n");
391 390
 				return -1;
392 391
 			}
393 392
 		}while ( (n=legs2strar(leg_info,rq,val_arr+m,0))!=0 );
... ...
@@ -462,13 +456,12 @@ int init_acc_rad(char *rad_cfg, int srv_type)
462 462
 
463 463
 	/* read config */
464 464
 	if ((rh = rc_read_config(rad_cfg)) == NULL) {
465
-		LOG(L_ERR,"ERROR:acc:init_acc_rad: error opening radius "
466
-			"config file: %s\n", rad_cfg );
465
+		LM_ERR("failed to open radius config file: %s\n", rad_cfg );
467 466
 		return -1;
468 467
 	}
469 468
 	/* read dictionary */
470 469
 	if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary"))!=0) {
471
-		LOG(L_ERR,"ERROR:acc:init_acc_rad: error reading radius dictionary\n");
470
+		LM_ERR("failed to read radius dictionary\n");
472 471
 		return -1;
473 472
 	}
474 473
 
... ...
@@ -497,8 +490,7 @@ static inline UINT4 rad_status( struct sip_msg *req, int code )
497 497
 	do { \
498 498
 		if ( (_len)!=0 && \
499 499
 		!rc_avpair_add( rh, &send, rd_attrs[_attr].v, _val, _len, 0)) { \
500
-			LOG(L_ERR, "ERROR:acc:acc_rad_request: failed to add %s, %d\n", \
501
-				rd_attrs[_attr].n,_attr); \
500
+			LM_ERR("failed to add %s, %d\n", rd_attrs[_attr].n,_attr); \
502 501
 			goto error; \
503 502
 		} \
504 503
 	}while(0)
... ...
@@ -553,7 +545,7 @@ int acc_rad_request( struct sip_msg *req )
553 553
 	}
554 554
 
555 555
 	if (rc_acct(rh, SIP_PORT, send)!=OK_RC) {
556
-		LOG(L_ERR, "ERROR:acc:acc_rad_request: radius-ing failed\n");
556
+		LM_ERR("radius-ing failed\n");
557 557
 		goto error;
558 558
 	}
559 559
 	rc_avpair_free(send);
... ...
@@ -595,16 +587,14 @@ int acc_diam_init()
595 595
 
596 596
 	m = extra2int( dia_extra, diam_attrs+n);
597 597
 	if (m<0) {
598
-		LOG(L_ERR,"ERROR:acc:acc_diam_init: extra names for DIAMTER must be "
599
-			" integer AVP codes\n");
598
+		LM_ERR("extra names for DIAMETER must be integer AVP codes\n");
600 599
 		return -1;
601 600
 	}
602 601
 	n += m;
603 602
 
604 603
 	m = extra2int( leg_info, diam_attrs+n);
605 604
 	if (m<0) {
606
-		LOG(L_ERR,"ERROR:acc:acc_diam_init: leg info names for DIAMTER must "
607
-			"be integer AVP codes\n");
605
+		LM_ERR("leg info names for DIAMTER must be integer AVP codes\n");
608 606
 		return -1;
609 607
 	}
610 608
 	n += m;
... ...
@@ -648,25 +638,24 @@ int acc_diam_request( struct sip_msg *req )
648 648
 	attr_cnt--;
649 649
 
650 650
 	if ( (send=AAAInMessage(ACCOUNTING_REQUEST, AAA_APP_NASREQ))==NULL) {
651
-		LOG(L_ERR, "ERROR:acc:acc_diam_request: failed to create new "
652
-			"AAA request\n");
651
+		LM_ERR("failed to create new AAA request\n");
653 652
 		return -1;
654 653
 	}
655 654
 
656 655
 	/* AVP_ACCOUNTIG_RECORD_TYPE */
657 656
 	if( (status = diam_status(req, acc_env.code))<0) {
658
-		LOG(L_ERR, "ERROR:acc:acc_diam_request: status unknown\n");
657
+		LM_ERR("status unknown\n");
659 658
 		goto error;
660 659
 	}
661 660
 	tmp[0] = status+'0';
662 661
 	tmp[1] = 0;
663 662
 	if( (avp=AAACreateAVP(AVP_Accounting_Record_Type, 0, 0, tmp,
664 663
 	1, AVP_DUPLICATE_DATA)) == 0) {
665
-		LOG(L_ERR,"ERROR:acc:acc_diam_request: no more free memory!\n");
664
+		LM_ERR("failed to create AVP:no more free memory!\n");
666 665
 		goto error;
667 666
 	}
668 667
 	if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) {
669
-		LOG(L_ERR, "ERROR:acc:acc_diam_request: avp not added \n");
668
+		LM_ERR("avp not added \n");
670 669
 		AAAFreeAVP(&avp);
671 670
 		goto error;
672 671
 	}
... ...
@@ -674,11 +663,11 @@ int acc_diam_request( struct sip_msg *req )
674 674
 	mid = req->id;
675 675
 	if( (avp=AAACreateAVP(AVP_SIP_MSGID, 0, 0, (char*)(&mid), 
676 676
 	sizeof(mid), AVP_DUPLICATE_DATA)) == 0) {
677
-		LOG(L_ERR, "ERROR:acc:acc_diam_request: no more free memory!\n");
677
+		LM_ERR("failed to create AVP:no more free memory!\n");
678 678
 		goto error;
679 679
 	}
680 680
 	if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) {
681
-		LOG(L_ERR, "ERROR:acc:acc_diam_request: avp not added \n");
681
+		LM_ERR("avp not added \n");
682 682
 		AAAFreeAVP(&avp);
683 683
 		goto error;
684 684
 	}
... ...
@@ -686,11 +675,11 @@ int acc_diam_request( struct sip_msg *req )
686 686
 	/* SIP Service AVP */
687 687
 	if( (avp=AAACreateAVP(AVP_Service_Type, 0, 0, SIP_ACCOUNTING, 
688 688
 	SERVICE_LEN, AVP_DUPLICATE_DATA)) == 0) {
689
-		LOG(L_ERR,"ERROR:acc:acc_diam_request: no more free memory!\n");
689
+		LM_ERR("failed to create AVP:no more free memory!\n");
690 690
 		goto error;
691 691
 	}
692 692
 	if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) {
693
-		LOG(L_ERR, "ERROR:acc:acc_diam_request: avp not added \n");
693
+		LM_ERR("avp not added \n");
694 694
 		AAAFreeAVP(&avp);
695 695
 		goto error;
696 696
 	}
... ...
@@ -702,11 +691,11 @@ int acc_diam_request( struct sip_msg *req )
702 702
 	for(i=0; i<attr_cnt; i++) {
703 703
 		if((avp=AAACreateAVP(diam_attrs[i], 0,0, val_arr[i].s, val_arr[i].len,
704 704
 		AVP_DUPLICATE_DATA)) == 0) {
705
-			LOG(L_ERR,"ERROR:acc:acc_diam_request: no more free memory!\n");
705
+			LM_ERR("failed to create AVP: no more free memory!\n");
706 706
 			goto error;
707 707
 		}
708 708
 		if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) {
709
-			LOG(L_ERR, "ERROR:acc:acc_diam_request: avp not added \n");
709
+			LM_ERR("avp not added \n");
710 710
 			AAAFreeAVP(&avp);
711 711
 			goto error;
712 712
 		}
... ...
@@ -719,12 +708,11 @@ int acc_diam_request( struct sip_msg *req )
719 719
 			for (i=0; i<cnt; i++) {
720 720
 				if((avp=AAACreateAVP(diam_attrs[attr_cnt+i], 0, 0,
721 721
 				val_arr[i].s, val_arr[i].len, AVP_DUPLICATE_DATA)) == 0) {
722
-					LOG(L_ERR,"ERROR:acc:acc_diam_request: no more "
723
-						"free memory!\n");
722
+					LM_ERR("failed to create AVP: no more free memory!\n");
724 723
 					goto error;
725 724
 				}
726 725
 				if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) {
727
-					LOG(L_ERR, "ERROR:acc:acc_diam_request: avp not added \n");
726
+					LM_ERR("avp not added \n");
728 727
 					AAAFreeAVP(&avp);
729 728
 					goto error;
730 729
 				}
... ...
@@ -733,39 +721,38 @@ int acc_diam_request( struct sip_msg *req )
733 733
 	}
734 734
 
735 735
 	if (get_uri(req, &uri) < 0) {
736
-		LOG(L_ERR, "ERROR:acc:acc_diam_request: From/To URI not found\n");
736
+		LM_ERR("failed to get uri, From/To URI not found\n");
737 737
 		goto error;
738 738
 	}
739 739
 
740 740
 	if (parse_uri(uri->s, uri->len, &puri) < 0) {
741
-		LOG(L_ERR, "ERROR:acc:acc_diam_request: Error parsing From/To URI\n");
741
+		LM_ERR("failed to parse From/To URI\n");
742 742
 		goto error;
743 743
 	}
744 744
 
745 745
 	/* Destination-Realm AVP */
746 746
 	if( (avp=AAACreateAVP(AVP_Destination_Realm, 0, 0, puri.host.s,
747 747
 	puri.host.len, AVP_DUPLICATE_DATA)) == 0) {
748
-		LOG(L_ERR,"ERROR:acc:acc_diam_request: no more free memory!\n");
748
+		LM_ERR("failed to create AVP:no more free memory!\n");
749 749
 		goto error;
750 750
 	}
751 751
 
752 752
 	if( AAAAddAVPToMessage(send, avp, 0)!= AAA_ERR_SUCCESS) {
753
-		LOG(L_ERR, "ERROR:acc:acc_diam_request: avp not added \n");
753
+		LM_ERR("avp not added \n");
754 754
 		AAAFreeAVP(&avp);
755 755
 		goto error;
756 756
 	}
757 757
 
758 758
 	/* prepare the message to be sent over the network */
759 759
 	if(AAABuildMsgBuffer(send) != AAA_ERR_SUCCESS) {
760
-		LOG(L_ERR, "ERROR:acc:acc_diam_request: message buffer not created\n");
760
+		LM_ERR("message buffer not created\n");
761 761
 		goto error;
762 762
 	}
763 763
 
764 764
 	if(sockfd==AAA_NO_CONNECTION) {
765 765
 		sockfd = init_mytcp(diameter_client_host, diameter_client_port);
766 766
 		if(sockfd==AAA_NO_CONNECTION) {
767
-			LOG(L_ERR, "ERROR:acc:acc_diam_request: failed to reconnect"
768
-								" to Diameter client\n");
767
+			LM_ERR("failed to reconnect to Diameter client\n");
769 768
 			goto error;
770 769
 		}
771 770
 	}
... ...
@@ -773,8 +760,8 @@ int acc_diam_request( struct sip_msg *req )
773 773
 	/* send the message to the DIAMETER client */
774 774
 	ret = tcp_send_recv(sockfd, send->buf.s, send->buf.len, rb, req->id);
775 775
 	if(ret == AAA_CONN_CLOSED) {
776
-		LOG(L_NOTICE, "NOTICE:acc:acc_diam_request: connection to Diameter"
777
-			" client closed.It will be reopened by the next request\n");
776
+		LM_NOTICE("connection to Diameter client closed.It will be "
777
+				"reopened by the next request\n");
778 778
 		close(sockfd);
779 779
 		sockfd = AAA_NO_CONNECTION;
780 780
 		goto error;
... ...
@@ -782,8 +769,8 @@ int acc_diam_request( struct sip_msg *req )
782 782
 
783 783
 	if(ret != ACC_SUCCESS) {
784 784
 		/* a transmission error occurred */
785
-		LOG(L_ERR, "ERROR:acc:acc_diam_request: message sending to the" 
786
-			" DIAMETER backend authorization server failed\n");
785
+		LM_ERR("message sending to the DIAMETER backend authorization "
786
+				"server failed\n");
787 787
 		goto error;
788 788
 	}
789 789
 
... ...
@@ -71,22 +71,20 @@ struct acc_extra *parse_acc_leg(char *extra_str)
71 71
 
72 72
 	legs = parse_acc_extra(extra_str);
73 73
 	if (legs==0) {
74
-		LOG(L_ERR,"ERROR:acc:parse_acc_leg: failed to parse extra leg\n");
74
+		LM_ERR("failed to parse extra leg\n");
75 75
 		return 0;
76 76
 	}
77 77
 
78 78
 	/* check the type and len */
79 79
 	for( it=legs,n=0 ; it ; it=it->next ) {
80 80
 		if (it->spec.type!=PVT_AVP) {
81
-			LOG(L_ERR,"ERROR:acc:parse_acc_leg: only AVP are accepted as "
82
-				"leg info\n");
81
+			LM_ERR("only AVP are accepted as leg info\n");
83 82
 			destroy_extras(legs);
84 83
 			return 0;
85 84
 		}
86 85
 		n++;
87 86
 		if (n>MAX_ACC_LEG) {
88
-			LOG(L_ERR,"ERROR:acc:parse_acc_leg: too many leg info; MAX=%d\n",
89
-				MAX_ACC_LEG);
87
+			LM_ERR("too many leg info; MAX=%d\n", MAX_ACC_LEG);
90 88
 			destroy_extras(legs);
91 89
 			return 0;
92 90
 		}
... ...
@@ -113,7 +111,7 @@ struct acc_extra *parse_acc_extra(char *extra_str)
113 113
 	s = extra_str;
114 114
 
115 115
 	if (s==0) {
116
-		LOG(L_ERR,"ERROR:acc:parse_acc_extra: null string received\n");
116
+		LM_ERR("null string received\n");
117 117
 		goto error;
118 118
 	}
119 119
 
... ...
@@ -123,13 +121,12 @@ struct acc_extra *parse_acc_extra(char *extra_str)
123 123
 		if (*s==0)
124 124
 			goto parse_error;
125 125
 		if (n==MAX_ACC_EXTRA) {
126
-			LOG(L_ERR,"ERROR:acc:parse_acc_extra: too many extras -> please "
127
-				"increase the internal buffer\n");
126
+			LM_ERR("too many extras -> please increase the internal buffer\n");
128 127
 			goto error;
129 128
 		}
130 129
 		extra = (struct acc_extra*)pkg_malloc(sizeof(struct acc_extra));
131 130
 		if (extra==0) {
132
-			LOG(L_ERR,"ERROR:acc:parse_acc_extra: no more pkg mem 1\n");
131
+			LM_ERR("no more pkg mem 1\n");
133 132
 			goto error;
134 133
 		}
135 134
 		memset( extra, 0, sizeof(struct acc_extra));
... ...
@@ -181,10 +178,10 @@ struct acc_extra *parse_acc_extra(char *extra_str)
181 181
 
182 182
 	return head;
183 183
 parse_error:
184
-	LOG(L_ERR,"ERROR:acc:parse_acc_extra: parse failed in <%s> "
184
+	LM_ERR("parse failed in <%s> "
185 185
 		"around position %d\n",extra_str, (int)(long)(s-extra_str));
186 186
 error:
187
-	LOG(L_ERR,"acc:parse_acc_extra: error\n");
187
+	LM_ERR("error\n");
188 188
 	destroy_extras(head);
189 189
 	return 0;
190 190
 }
... ...
@@ -229,8 +226,7 @@ int extra2int( struct acc_extra *extra, int *attrs )
229 229
 
230 230
 	for( i=0 ; extra ; i++,extra=extra->next ) {
231 231
 		if (str2int( &extra->name, &ui)!=0) {
232
-			LOG(L_ERR,"ERROR:acc:extra2int: <%s> is not a number\n",
233
-				extra->name.s);
232
+			LM_ERR("<%s> is not a number\n", extra->name.s);
234 233
 			return -1;
235 234
 		}
236 235
 		attrs[i] = (int)ui;
... ...
@@ -252,14 +248,12 @@ int extra2strar( struct acc_extra *extra, struct sip_msg *rq, str *val_arr)
252 252
 	while (extra) {
253 253
 		/* get the value */
254 254
 		if (pv_get_spec_value( rq, &extra->spec, &value)!=0) {
255
-			LOG(L_ERR,"ERROR:acc:extra2strar: failed to get '%.*s'\n",
256
-				extra->name.len,extra->name.s);
255
+			LM_ERR("failed to get '%.*s'\n", extra->name.len,extra->name.s);
257 256
 		}
258 257
 
259 258
 		/* check for overflow */
260 259
 		if (n==MAX_ACC_EXTRA) {
261
-			LOG(L_WARN,"WARNING:acc:extra2strar: array to short "
262
-				"-> ommiting extras for accounting\n");
260
+			LM_WARN("array to short -> ommiting extras for accounting\n");
263 261
 			goto done;
264 262
 		}
265 263
 
... ...
@@ -149,7 +149,7 @@ static inline int acc_preparse_req(struct sip_msg *req)
149 149
 {
150 150
 	if ( (parse_headers(req,HDR_CALLID_F|HDR_CSEQ_F|HDR_FROM_F|HDR_TO_F,0)<0)
151 151
 	|| (parse_from_header(req)<0 ) ) {
152
-		LOG(L_ERR,"ERROR:acc:acc_preparse_req: failed to preparse request\n");
152
+		LM_ERR("failed to preparse request\n");
153 153
 		return -1;
154 154
 	}
155 155
 	return 0;
... ...
@@ -172,7 +172,7 @@ int w_acc_log_request(struct sip_msg *rq, char *comment, char *foo)
172 172
 int w_acc_db_request(struct sip_msg *rq, char *comment, char *table)
173 173
 {
174 174
 	if (!table) {
175
-		LOG(L_ERR,"ERROR:acc:w_acc_db_request: DB support not configured\n");
175
+		LM_ERR("db support not configured\n");
176 176
 		return -1;
177 177
 	}
178 178
 	if (acc_preparse_req(rq)<0)
... ...
@@ -230,18 +230,17 @@ void acc_onreq( struct cell* t, int type, struct tmcb_params *ps )
230 230
 			/* report on missed calls */
231 231
 			((is_invite(t) && is_mc_on(ps->req))?TMCB_ON_FAILURE:0) ;
232 232
 		if (tmb.register_tmcb( 0, t, tmcb_types, tmcb_func, 0 )<=0) {
233
-			LOG(L_ERR,"ERROR:acc:acc_onreq: cannot register additional "
234
-				"callbacks\n");
233
+			LM_ERR("cannot register additional callbacks\n");
235 234
 			return;
236 235
 		}
237 236
 		/* also, if that is INVITE, disallow silent t-drop */
238 237
 		if (ps->req->REQ_METHOD==METHOD_INVITE) {
239
-			DBG("DEBUG: noisy_timer set for accounting\n");
238
+			LM_DBG("noisy_timer set for accounting\n");
240 239
 			t->flags |= T_NOISY_CTIMER_FLAG;
241 240
 		}
242 241
 		/* if required, determine request direction */
243 242
 		if( detect_direction && !rrb.is_direction(ps->req,RR_FLOW_UPSTREAM) ) {
244
-			DBG("DBUG:acc:acc_onreq: UPSTREAM req detected -> flaging it\n");
243
+			LM_DBG("detected an UPSTREAM req -> flaging it\n");
245 244
 			ps->req->msg_flags |= FL_REQ_UPSTREAM;
246 245
 		}
247 246
 	}
... ...
@@ -255,14 +255,14 @@ static int acc_fixup(void** param, int param_no)
255 255
 
256 256
 	p = (char*)*param;
257 257
 	if (p==0 || p[0]==0) {
258
-		LOG(L_ERR,"ERROR:acc:acc_fixup: first parameter is empty\n");
258
+		LM_ERR("first parameter is empty\n");
259 259
 		return E_SCRIPT;
260 260
 	}
261 261
 
262 262
 	if (param_no == 1) {
263 263
 		accp = (struct acc_param*)pkg_malloc(sizeof(struct acc_param));
264 264
 		if (!accp) {
265
-			LOG(L_ERR, "ERROR:acc:acc_fixup: no more pkg mem\n");
265
+			LM_ERR("no more pkg mem\n");
266 266
 			return E_OUT_OF_MEM;
267 267
 		}
268 268
 		memset( accp, 0, sizeof(struct acc_param));
... ...
@@ -297,7 +297,7 @@ static int acc_fixup(void** param, int param_no)
297 297
 
298 298
 static int mod_init( void )
299 299
 {
300
-	LOG(L_INFO,"ACC - initializing\n");
300
+	LM_INFO("initializing...\n");
301 301
 
302 302
 	/* ----------- GENERIC INIT SECTION  ----------- */
303 303
 
... ...
@@ -306,20 +306,19 @@ static int mod_init( void )
306 306
 
307 307
 	/* load the TM API */
308 308
 	if (load_tm_api(&tmb)!=0) {
309
-		LOG(L_ERR, "ERROR:acc:mod_init: can't load TM API\n");
309
+		LM_ERR("can't load TM API\n");
310 310
 		return -1;
311 311
 	}
312 312
 
313 313
 	/* if detect_direction is enabled, load rr also */
314 314
 	if (detect_direction && load_rr_api(&rrb)!=0) {
315
-		LOG(L_ERR, "ERROR:acc:mod_init: can't load RR API\n");
315
+		LM_ERR("can't load RR API\n");
316 316
 		return -1;
317 317
 	}
318 318
 
319 319
 	/* listen for all incoming requests  */
320 320
 	if ( tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, acc_onreq, 0 ) <=0 ) {
321
-		LOG(L_ERR,"ERROR:acc:mod_init: cannot register TMCB_REQUEST_IN "
322
-			"callback\n");
321
+		LM_ERR("cannot register TMCB_REQUEST_IN callback\n");
323 322
 		return -1;
324 323
 	}
325 324
 
... ...
@@ -328,7 +327,7 @@ static int mod_init( void )
328 328
 
329 329
 	/* configure multi-leg accounting */
330 330
 	if (leg_info_str && (leg_info=parse_acc_leg(leg_info_str))==0 ) {
331
-		LOG(L_ERR,"ERROR:acc:mod_init: failed to parse multileg_info param\n");
331
+		LM_ERR("failed to parse multileg_info param\n");
332 332
 		return -1;
333 333
 	}
334 334
 
... ...
@@ -336,7 +335,7 @@ static int mod_init( void )
336 336
 
337 337
 	/* parse the extra string, if any */
338 338
 	if (log_extra_str && (log_extra=parse_acc_extra(log_extra_str))==0 ) {
339
-		LOG(L_ERR,"ERROR:acc:mod_init: failed to parse log_extra param\n");
339
+		LM_ERR("failed to parse log_extra param\n");
340 340
 		return -1;
341 341
 	}
342 342
 
... ...
@@ -354,12 +353,11 @@ static int mod_init( void )
354 354
 	if (db_url && db_url[0]) {
355 355
 		/* parse the extra string, if any */
356 356
 		if (db_extra_str && (db_extra=parse_acc_extra(db_extra_str))==0 ) {
357
-			LOG(L_ERR,"ERROR:acc:mod_init: failed to parse db_extra param\n");
357
+			LM_ERR("failed to parse db_extra param\n");
358 358
 			return -1;
359 359
 		}
360 360
 		if (acc_db_init(db_url)<0){
361
-			LOG(L_ERR, "ERROR:acc:mod_init: acc_db_init: failed..."
362
-				"did you load a database module?\n");
361
+			LM_ERR("failed...did you load a database module?\n");
363 362
 			return -1;
364 363
 		}
365 364
 		/* fix the flags */
... ...
@@ -380,7 +378,7 @@ static int mod_init( void )
380 380
 	if (radius_config && radius_config[0]) {
381 381
 		/* parse the extra string, if any */
382 382
 		if (rad_extra_str && (rad_extra=parse_acc_extra(rad_extra_str))==0 ) {
383
-			LOG(L_ERR,"ERROR:acc:mod_init: failed to parse rad_extra param\n");
383
+			LM_ERR("failed to parse rad_extra param\n");
384 384
 			return -1;
385 385
 		}
386 386
 
... ...
@@ -390,7 +388,7 @@ static int mod_init( void )
390 390
 		if (flag_idx2mask(&radius_missed_flag)<0)
391 391
 			return -1;
392 392
 		if (init_acc_rad( radius_config, service_type)!=0 ) {
393
-			LOG(L_ERR,"ERROR:acc:mod_init: failed to init radius\n");
393
+			LM_ERR("failed to init radius\n");
394 394
 			return -1;
395 395
 		}
396 396
 	} else {
... ...
@@ -411,12 +409,12 @@ static int mod_init( void )
411 411
 
412 412
 	/* parse the extra string, if any */
413 413
 	if (dia_extra_str && (dia_extra=parse_acc_extra(dia_extra_str))==0 ) {
414
-		LOG(L_ERR,"ERROR:acc:mod_init: failed to parse dia_extra param\n");
414
+		LM_ERR("failed to parse dia_extra param\n");
415 415
 		return -1;
416 416
 	}
417 417
 
418 418
 	if (acc_diam_init()!=0) {
419
-		LOG(L_ERR,"ERROR:acc:mod_init: failed to init diameter engine\n");
419
+		LM_ERR("failed to init diameter engine\n");
420 420
 		return -1;
421 421
 	}
422 422
 
... ...
@@ -435,23 +433,22 @@ static int child_init(int rank)
435 435
 	/* DIAMETER */
436 436
 #ifdef DIAM_ACC
437 437
 	/* open TCP connection */
438
-	DBG("DEBUG:acc:child_init:: Initializing TCP connection\n");
438
+	LM_DBG("initializing TCP connection\n");
439 439
 
440 440
 	sockfd = init_mytcp(diameter_client_host, diameter_client_port);
441 441
 	if(sockfd==-1) 
442 442
 	{
443
-		LOG(L_ERR,"ERROR:acc:child_init:: TCP connection not established\n");
443
+		LM_ERR("TCP connection not established\n");
444 444
 		return -1;
445 445
 	}
446 446
 
447
-	DBG("DEBUG:acc:child_init: TCP connection established on sockfd=%d\n",
448
-		sockfd);
447
+	LM_DBG("a TCP connection was established on sockfd=%d\n", sockfd);
449 448
 
450 449
 	/* every child with its buffer */
451 450
 	rb = (rd_buf_t*)pkg_malloc(sizeof(rd_buf_t));
452 451
 	if(!rb)
453 452
 	{
454
-		DBG("acc: mod_child_init: no more free memory\n");
453
+		LM_DBG("no more pkg memory\n");
455 454
 		return -1;
456 455
 	}
457 456
 	rb->buf = 0;
... ...
@@ -114,8 +114,7 @@ AAA_AVP*  AAACreateAVP(
114 114
 
115 115
 	/* first check the params */
116 116
 	if( data==0 || length==0) {
117
-		LOG(L_ERR,"ERROR:AAACreateAndAddAVPToList: NULL value received for"
118
-			" param data/length !!\n");
117
+		LM_ERR("null value received for param data/length !!\n");
119 118
 		return 0;
120 119
 	}
121 120
 
... ...
@@ -150,7 +149,7 @@ AAA_AVP*  AAACreateAVP(
150 150
 
151 151
 	return avp;
152 152
 error:
153
-	LOG(L_ERR,"ERROR:AAACreateAVP: no more free memory!\n");
153
+	LM_ERR("no more free memoryfor a new AVP!\n");
154 154
 	return 0;
155 155
 }
156 156
 
... ...
@@ -165,8 +164,8 @@ AAAReturnCode  AAAAddAVPToMessage(
165 165
 	AAA_AVP *avp_t;
166 166
 
167 167
 	if ( !msg || !avp ) {
168
-		LOG(L_ERR,"ERROR:AAAAddAVPToList: param msg or avp passed null"
169
-			" or *avpList=NULL and position!=NULL !!\n");
168
+		LM_ERR("param msg or avp passed null or *avpList=NULL "
169
+				"and position!=NULL !!\n");
170 170
 		return AAA_ERR_PARAMETER;
171 171
 	}
172 172
 
... ...
@@ -183,8 +182,7 @@ AAAReturnCode  AAAAddAVPToMessage(
183 183
 		/* look after avp from position */
184 184
 		for(avp_t=msg->avpList.head;avp_t&&avp_t!=position;avp_t=avp_t->next);
185 185
 		if (!avp_t) {
186
-			LOG(L_ERR,"ERROR: AAACreateAVP: the \"position\" avp is not in"
187
-				"\"msg\" message!!\n");
186
+			LM_ERR("the \"position\" avp is not in \"msg\" message!!\n");
188 187
 			return AAA_ERR_PARAMETER;
189 188
 		}
190 189
 		/* insert after position */
... ...
@@ -224,14 +222,13 @@ AAA_AVP  *AAAFindMatchingAVP(
224 224
 
225 225
 	/* param checking */
226 226
 	if (!msg) {
227
-		LOG(L_ERR,"ERROR:FindMatchingAVP: param msg passed null !!\n");
227
+		LM_ERR("param msg passed null !!\n");
228 228
 		goto error;
229 229
 	}
230 230
 	/* search the startAVP avp */
231 231
 	for(avp_t=msg->avpList.head;avp_t&&avp_t!=startAvp;avp_t=avp_t->next);
232 232
 	if (!avp_t && startAvp) {
233
-		LOG(L_ERR,"ERROR: AAAFindMatchingAVP: the \"position\" avp is not in"
234
-			"\"avpList\" list!!\n");
233
+		LM_ERR("the \"position\" avp is not in \"avpList\" list!!\n");
235 234
 		goto error;
236 235
 	}
237 236
 
... ...
@@ -265,16 +262,14 @@ AAAReturnCode  AAARemoveAVPFromMessage(
265 265
 
266 266
 	/* param check */
267 267
 	if ( !msg || !avp ) {
268
-		LOG(L_ERR,"ERROR:AAAAddAVPToList: param AVP_LIST \"avpList\" or AVP "
269
-			"\"avp\" passed null !!\n");
268
+		LM_ERR("param AVP_LIST \"avpList\" or AVP \"avp\" passed null !!\n");
270 269
 		return AAA_ERR_PARAMETER;
271 270
 	}
272 271
 
273 272
 	/* search the "avp" avp */
274 273
 	for(avp_t=msg->avpList.head;avp_t&&avp_t!=avp;avp_t=avp_t->next);
275 274
 	if (!avp_t) {
276
-		LOG(L_ERR,"ERROR: AAACreateAVP: the \"avp\" avp is not in "
277
-			"\"avpList\" avp list!!\n");
275
+		LM_ERR("the \"avp\" avp is not in \"avpList\" avp list!!\n");
278 276
 		return AAA_ERR_PARAMETER;
279 277
 	}
280 278
 
... ...
@@ -310,7 +305,7 @@ AAAReturnCode  AAAFreeAVP(AAA_AVP **avp)
310 310
 {
311 311
 	/* some checks */
312 312
 	if (!avp || !(*avp)) {
313
-		LOG(L_ERR,"ERROR:AAAFreeAVP: param avp cannot be null!!\n");
313
+		LM_ERR("param avp cannot be null!!\n");
314 314
 		return AAA_ERR_PARAMETER;
315 315
 	}
316 316
 
... ...
@@ -366,8 +361,7 @@ char*  AAAConvertAVPToString(AAA_AVP *avp, char *dest, unsigned int destLen)
366 366
 	int i;
367 367
 
368 368
 	if (!avp || !dest || !destLen) {
369
-		LOG(L_ERR,"ERROR:AAAConvertAVPToString: param AVP, DEST or DESTLEN "
370
-			"passed as null!!!\n");
369
+		LM_ERR("param AVP, DEST or DESTLEN passed as null!!!\n");
371 370
 		return 0;
372 371
 	}
373 372
 	l = snprintf(dest,destLen,"AVP(%p < %p >%p):packetType=%u;code=%u,"
... ...
@@ -414,7 +408,7 @@ char*  AAAConvertAVPToString(AAA_AVP *avp, char *dest, unsigned int destLen)
414 414
 		//case AAA_AVP_INTEGER64_TYPE:
415 415
 		case AAA_AVP_TIME_TYPE:
416 416
 		default:
417
-			LOG(L_WARN,"WARNING:AAAConvertAVPToString: don't know how to print"
417
+			LM_WARN("don't know how to print"
418 418
 				" this data type [%d] -> tryng hexa\n",avp->type);
419 419
 		case AAA_AVP_DATA_TYPE:
420 420
 			for (i=0;i<avp->data.len&&l<destLen-1;i++)
... ...
@@ -436,7 +430,7 @@ AAA_AVP* AAACloneAVP( AAA_AVP *avp , unsigned char clone_data)
436 436
 	/* clone the avp structure */
437 437
 	n_avp = (AAA_AVP*)ad_malloc( sizeof(AAA_AVP) );
438 438
 	if (!n_avp) {
439
-		LOG(L_ERR,"ERROR:clone_avp: cannot get free memory!!\n");
439
+		LM_ERR("cannot get free memory!!\n");
440 440
 		goto error;
441 441
 	}
442 442
 	memcpy( n_avp, avp, sizeof(AAA_AVP));
... ...
@@ -446,7 +440,7 @@ AAA_AVP* AAACloneAVP( AAA_AVP *avp , unsigned char clone_data)
446 446
 		/* clone the avp data */
447 447
 		n_avp->data.s = (char*)ad_malloc( avp->data.len );
448 448
 		if (!(n_avp->data.s)) {
449
-			LOG(L_ERR,"ERROR:clone_avp: cannot get free memory!!\n");
449
+			LM_ERR("cannot get free memory!!\n");
450 450
 			ad_free( n_avp );
451 451
 			goto error;
452 452
 		}
... ...
@@ -73,7 +73,7 @@ AAAReturnCode AAABuildMsgBuffer( AAAMessage *msg )
73 73
 	/* allocate some memory */
74 74
 	msg->buf.s = (char*)ad_malloc( msg->buf.len );
75 75
 	if (!msg->buf.s) {
76
-		LOG(L_ERR,"ERROR:AAABuildMsgBuffer: no more free memory!\n");
76
+		LM_ERR("no more pkg free memory!\n");
77 77
 		goto error;
78 78
 	}
79 79
 	memset(msg->buf.s, 0, msg->buf.len);
... ...
@@ -123,13 +123,13 @@ AAAReturnCode AAABuildMsgBuffer( AAAMessage *msg )
123 123
 	}
124 124
 
125 125
 	if ((char*)p-msg->buf.s!=msg->buf.len) {
126
-		LOG(L_ERR,"BUG: build_buf_from_msg: mismatch between len and buf!\n");
126
+		LM_ERR("mismatch between len and buf!\n");
127 127
 		ad_free( msg->buf.s );
128 128
 		msg->buf.s = 0;
129 129
 		msg->buf.len = 0;
130 130
 		goto error;
131 131
 	}
132
-	DBG("Message: %.*s\n", msg->buf.len, msg->buf.s);
132
+	LM_DBG("Message: %.*s\n", msg->buf.len, msg->buf.s);
133 133
 	return AAA_ERR_SUCCESS;
134 134
 error:
135 135
 	return -1;
... ...
@@ -203,7 +203,7 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
203 203
 
204 204
 	/* check the params */
205 205
 	if( !source || !sourceLen || sourceLen<AAA_MSG_HDR_SIZE) {
206
-		LOG(L_ERR,"ERROR:AAATranslateMessage: invalid buffered received!\n");
206
+		LM_ERR("invalid buffered received!\n");
207 207
 		goto error;
208 208
 	}
209 209
 
... ...
@@ -215,7 +215,7 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
215 215
 	/* alloc a new message structure */
216 216
 	msg = (AAAMessage*)ad_malloc(sizeof(AAAMessage));
217 217
 	if (!msg) {
218
-		LOG(L_ERR,"ERROR:AAATranslateMessage: no more free memory!!\n");
218
+		LM_ERR("no more pkg free memory!!\n");
219 219
 		goto error;
220 220
 	}
221 221
 	memset(msg,0,sizeof(AAAMessage));
... ...
@@ -224,8 +224,7 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
224 224
 	version = (unsigned char)*ptr;
225 225
 	ptr += VER_SIZE;
226 226
 	if (version!=1) {
227
-		LOG(L_ERR,"ERROR:AAATranslateMessage: invalid version [%d]in "
228
-			"AAA msg\n",version);
227
+		LM_ERR("invalid version [%d]in AAA msg\n",version);
229 228
 		goto error;
230 229
 	}
231 230
 
... ...
@@ -233,8 +232,8 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
233 233
 	msg_len = get_3bytes( ptr );
234 234
 	ptr += MESSAGE_LENGTH_SIZE;
235 235
 	if (msg_len>sourceLen) {
236
-		LOG(L_ERR,"ERROR:AAATranslateMessage: AAA message len [%d] bigger then"
237
-			" buffer len [%d]\n",msg_len,sourceLen);
236
+		LM_ERR("AAA message len [%d] bigger then buffer len [%d]\n",
237
+				msg_len,sourceLen);
238 238
 		goto error;
239 239
 	}
240 240
 
... ...
@@ -261,7 +260,7 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
261 261
 	/* start decoding the AVPS */
262 262
 	while (ptr < source+msg_len) {
263 263
 		if (ptr+AVP_HDR_SIZE(0x80)>source+msg_len){
264
-			LOG(L_ERR,"ERROR:AAATranslateMessage: source buffer to short!! "
264
+			LM_ERR("source buffer to short!! "
265 265
 				"Cannot read the whole AVP header!\n");
266 266
 			goto error;
267 267
 		}
... ...
@@ -275,8 +274,7 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
275 275
 		avp_len = get_3bytes( ptr );
276 276
 		ptr += AVP_LENGTH_SIZE;
277 277
 		if (avp_len<1) {
278
-			LOG(L_ERR,"ERROR:AAATranslateMessage: invalid AVP len [%d]\n",
279
-				avp_len);
278
+			LM_ERR("invalid AVP len [%d]\n", avp_len);
280 279
 			goto error;
281 280
 		}
282 281
 		/* avp vendor-ID */
... ...
@@ -289,7 +287,7 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
289 289
 		avp_data_len = avp_len-AVP_HDR_SIZE(avp_flags);
290 290
 		/*check the data length */
291 291
 		if ( source+msg_len<ptr+avp_data_len) {
292
-			LOG(L_ERR,"ERROR:AAATranslateMessage: source buffer to short!! "
292
+			LM_ERR("source buffer to short!! "
293 293
 				"Cannot read a whole data for AVP!\n");
294 294
 			goto error;
295 295
 		}
... ...
@@ -315,7 +313,7 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
315 315
 	//AAAPrintMessage( msg );
316 316
 	return  msg;
317 317
 error:
318
-	LOG(L_ERR,"ERROR:AAATranslateMessage: message conversion droped!!\n");
318
+	LM_ERR("message conversion droped!!\n");
319 319
 	AAAFreeMessage(&msg);
320 320
 	return 0;
321 321
 }
... ...
@@ -330,15 +328,15 @@ void AAAPrintMessage( AAAMessage *msg)
330 330
 	AAA_AVP *avp;
331 331
 
332 332
 	/* print msg info */
333
-	DBG("DEBUG: ACC: AAA_MESSAGE - %p\n",msg);
334
-	DBG("\tCode = %u\n",msg->commandCode);
335
-	DBG("\tFlags = %x\n",msg->flags);
333
+	LM_DBG("AAA_MESSAGE - %p\n",msg);
334
+	LM_DBG("\tCode = %u\n",msg->commandCode);
335
+	LM_DBG("\tFlags = %x\n",msg->flags);
336 336
 
337 337
 	/*print the AVPs */
338 338
 	avp = msg->avpList.head;
339 339
 	while (avp) {
340 340
 		AAAConvertAVPToString(avp,buf,1024);
341
-		DBG("\n%s\n",buf);
341
+		LM_DBG("\n%s\n",buf);
342 342
 		avp=avp->next;
343 343
 	}
344 344
 }
... ...
@@ -351,7 +349,7 @@ AAAMessage* AAAInMessage(AAACommandCode cmdCode,
351 351
 	/* allocated a new AAAMessage structure a set it to 0 */
352 352
 	msg = (AAAMessage*)ad_malloc(sizeof(AAAMessage));
353 353
 	if (!msg) {
354
-		LOG(L_ERR, "AAAInMessage(): no more free memory!\n");
354
+		LM_ERR("no more pkg free memory!\n");
355 355
 		return NULL;
356 356
 	}
357 357
 	memset(msg, 0, sizeof(AAAMessage));
... ...
@@ -53,14 +53,14 @@ int init_mytcp(char* host, int port)
53 53
 	
54 54
     if (sockfd < 0) 
55 55
 	{
56
-		LOG(L_ERR, M_NAME":init_mytcp(): error creating the socket\n");
56
+		LM_ERR("failed to create the socket\n");
57 57
 		return -1;
58 58
 	}	
59 59
 	
60 60
     server = gethostbyname(host);
61 61
     if (server == NULL) 
62 62
 	{
63
-		LOG(L_ERR, M_NAME":init_mytcp(): error finding the host\n");
63
+		LM_ERR("failed to find the host\n");
64 64
 		return -1;
65 65
     }
66 66
 
... ...
@@ -73,8 +73,7 @@ int init_mytcp(char* host, int port)
73 73
     if (connect(sockfd, (const struct sockaddr *)&serv_addr, 
74 74
 							sizeof(serv_addr)) < 0) 
75 75
 	{
76
-        LOG(L_ERR, M_NAME":init_mytcp(): error connecting to the "
77
-						"DIAMETER client\n");
76
+        LM_ERR("failed to connec to the DIAMETER client\n");
78 77
 		return -1;
79 78
 	}	
80 79
 
... ...
@@ -99,13 +98,13 @@ int tcp_send_recv(int sockfd, char* buf, int len, rd_buf_t* rb,
99 99
 	{
100 100
 		if (errno==EINTR)
101 101
 			continue;
102
-		LOG(L_ERR, M_NAME": write returned error: %s\n", strerror(errno));
102
+		LM_ERR("write returned error: %s\n", strerror(errno));
103 103
 		return AAA_ERROR;
104 104
 	}
105 105
 
106 106
 	if (n!=len) 
107 107
 	{
108
-		LOG(L_ERR, M_NAME": write gave no error but wrote less than asked\n");
108
+		LM_ERR("write gave no error but wrote less than asked\n");
109 109
 		return AAA_ERROR;
110 110
 	}
111 111
 	/* wait for the answer a limited amount of time */
... ...
@@ -122,13 +121,13 @@ int tcp_send_recv(int sockfd, char* buf, int len, rd_buf_t* rb,
122 122
 		read_fd_set = active_fd_set;
123 123
 		if (select (sockfd+1, &read_fd_set, NULL, NULL, &tv) < 0)
124 124
 		{
125
-			LOG(L_ERR, M_NAME":tcp_send_msg(): select function failed\n");
125
+			LM_ERR("select function failed\n");
126 126
 			return AAA_ERROR;
127 127
 		}
128 128
 
129 129
 /*		if (!FD_ISSET (sockfd, &read_fd_set))
130 130
 		{
131
-			LOG(L_ERR, M_NAME":tcp_send_rcv(): no response received\n");
131
+			LM_ERR("no response received\n");
132 132
 //			return AAA_ERROR;
133 133
 		}
134 134
 */		/* Data arriving on a already-connected socket. */
... ...
@@ -136,10 +135,10 @@ int tcp_send_recv(int sockfd, char* buf, int len, rd_buf_t* rb,
136 136
 		switch( do_read(sockfd, rb) )
137 137
 		{
138 138
 			case CONN_ERROR:
139
-				LOG(L_ERR, M_NAME": error when trying to read from socket\n");
139
+				LM_ERR("failed to read from socket\n");
140 140
 				return AAA_CONN_CLOSED;
141 141
 			case CONN_CLOSED:
142
-				LOG(L_ERR, M_NAME": error when trying to read from socket\n");
142
+				LM_ERR("failed to read from socket\n");
143 143
 				return AAA_CONN_CLOSED;
144 144
 		}
145 145
 		
... ...
@@ -147,28 +146,28 @@ int tcp_send_recv(int sockfd, char* buf, int len, rd_buf_t* rb,
147 147
 		msg = AAATranslateMessage(rb->buf, rb->buf_len, 0);	
148 148
 		if(!msg)
149 149
 		{
150
-			LOG(L_ERR, M_NAME": message structure not obtained\n");	
150
+			LM_ERR("message structure not obtained\n");	
151 151
 			return AAA_ERROR;
152 152
 		}
153 153
 		avp = AAAFindMatchingAVP(msg, NULL, AVP_SIP_MSGID,
154 154
 								vendorID, AAA_FORWARD_SEARCH);
155 155
 		if(!avp)
156 156
 		{
157
-			LOG(L_ERR, M_NAME": AVP_SIP_MSGID not found\n");
157
+			LM_ERR("AVP_SIP_MSGID not found\n");
158 158
 			return AAA_ERROR;
159 159
 		}
160 160
 		m_id = *((unsigned int*)(avp->data.s));
161
-		DBG("######## m_id=%d\n", m_id);
161
+		LM_DBG("######## m_id=%d\n", m_id);
162 162
 		if(m_id!=waited_id)
163 163
 		{
164 164
 			number_of_tries ++;
165
-			LOG(L_NOTICE, M_NAME": old message received\n");
165
+			LM_NOTICE("old message received\n");
166 166
 			continue;
167 167
 		}
168 168
 		goto next;
169 169
 	}
170 170
 
171
-	LOG(L_ERR, M_NAME": too many old messages received\n");
171
+	LM_ERR("too many old messages received\n");
172 172
 	return AAA_TIMEOUT;
173 173
 next:
174 174
 
... ...
@@ -177,7 +176,7 @@ next:
177 177
 							vendorID, AAA_FORWARD_SEARCH);
178 178
 	if(!avp)
179 179
 	{
180
-		LOG(L_ERR, M_NAME": AVP_Service_Type not found\n");
180
+		LM_ERR("AVP_Service_Type not found\n");
181 181
 		return AAA_ERROR;
182 182
 	}
183 183
 	serviceType = avp->data.s[0];
... ...
@@ -221,12 +220,11 @@ int do_read( int socket, rd_buf_t *p)
221 221
 
222 222
 	while( (n=recv( socket, ptr, wanted_len, MSG_DONTWAIT ))>0 ) 
223 223
 	{
224
-//		DBG("DEBUG:do_read (sock=%d)  -> n=%d (expected=%d)\n",
225
-//			p->sock,n,wanted_len);
224
+//		LM_DBG("(sock=%d)  -> n=%d (expected=%d)\n", p->sock,n,wanted_len);
226 225
 		p->buf_len += n;
227 226
 		if (n<wanted_len)
228 227
 		{
229
-			//DBG("only %d bytes read from %d expected\n",n,wanted_len);
228
+			//LM_DBG("only %d bytes read from %d expected\n",n,wanted_len);
230 229
 			wanted_len -= n;
231 230
 			ptr += n;
232 231
 		}
... ...
@@ -238,14 +236,14 @@ int do_read( int socket, rd_buf_t *p)
238 238
 				len = ntohl(p->first_4bytes)&0x00ffffff;
239 239
 				if (len<AAA_MSG_HDR_SIZE || len>MAX_AAA_MSG_SIZE)
240 240
 				{
241
-					LOG(L_ERR,"ERROR:do_read (sock=%d): invalid message "
241
+					LM_ERR("(sock=%d): invalid message "
242 242
 						"length read %u (%x)\n", socket, len, p->first_4bytes);
243 243
 					goto error;
244 244
 				}
245
-				//DBG("message length = %d(%x)\n",len,len);
245
+				//LM_DBG("message length = %d(%x)\n",len,len);
246 246
 				if ( (p->buf=pkg_malloc(len))==0  )
247 247
 				{
248
-					LOG(L_ERR,"ERROR:do_read: no more free memory\n");
248
+					LM_ERR("no more pkg memory\n");
249 249
 					goto error;
250 250
 				}
251 251
 				*((unsigned int*)p->buf) = p->first_4bytes;
... ...
@@ -258,7 +256,7 @@ int do_read( int socket, rd_buf_t *p)
258 258
 			else
259 259
 			{
260 260
 				/* I finished reading the whole message */
261
-				DBG("DEBUG:do_read (sock=%d): whole message read (len=%d)!\n",
261
+				LM_DBG("(sock=%d): whole message read (len=%d)!\n",
262 262
 					socket, p->first_4bytes);
263 263
 				return CONN_SUCCESS;
264 264
 			}
... ...
@@ -267,12 +265,12 @@ int do_read( int socket, rd_buf_t *p)
267 267
 
268 268
 	if (n==0)
269 269
 	{
270
-		LOG(L_INFO,"INFO:do_read (sock=%d): FIN received\n", socket);
270
+		LM_INFO("(sock=%d): FIN received\n", socket);
271 271
 		return CONN_CLOSED;
272 272
 	}
273 273
 	if ( n==-1 && errno!=EINTR && errno!=EAGAIN )
274 274
 	{
275
-		LOG(L_ERR,"ERROR:do_read (sock=%d): n=%d , errno=%d (%s)\n",
275
+		LM_ERR("(on sock=%d): n=%d , errno=%d (%s)\n",
276 276
 			socket, n, errno, strerror(errno));
277 277
 		goto error;
278 278
 	}
... ...
@@ -296,7 +294,7 @@ int get_uri(struct sip_msg* m, str** uri)
296 296
 	{/* REGISTER */
297 297
 		if (!m->to && ((parse_headers(m, HDR_TO_F, 0) == -1) || !m->to )) 
298 298
 		{
299
-			LOG(L_ERR, M_NAME": To header field not found or malformed\n");
299
+			LM_ERR("the To header field was not found or malformed\n");
300 300
 			return -1;
301 301
 		}
302 302
 		*uri = &(get_to(m)->uri);
... ...
@@ -305,7 +303,7 @@ int get_uri(struct sip_msg* m, str** uri)
305 305
 	{
306 306
 		if (parse_from_header(m)<0)
307 307
 		{
308
-			LOG(L_ERR, M_NAME": Error while parsing headers\n");
308
+			LM_ERR("failed to parse headers\n");
309 309
 			return -2;
310 310
 		}
311 311
 		*uri = &(get_from(m)->uri);
... ...
@@ -112,7 +112,7 @@ static int child_init(int rank)
112 112
 	db_handle = adbf.init(db_url);
113 113
 	if (!db_handle)
114 114
 	{
115
-		LOG(L_ERR, "alias_db:init_child: Unable to connect database\n");
115
+		LM_ERR("unable to connect database\n");
116 116
 		return -1;
117 117
 	}
118 118
 	return 0;
... ...
@@ -125,17 +125,17 @@ static int child_init(int rank)
125 125
  */
126 126
 static int mod_init(void)
127 127
 {
128
-	DBG("alias_db module - initializing\n");
128
+	LM_INFO("initializing...\n");
129 129
 
130 130
     /* Find a database module */
131 131
 	if (bind_dbmod(db_url, &adbf))
132 132
 	{
133
-		LOG(L_ERR, "alias_db:mod_init: Unable to bind database module\n");
133
+		LM_ERR("unable to bind database module\n");
134 134
 		return -1;
135 135
 	}
136 136
 	if (!DB_CAPABILITY( adbf, DB_CAP_QUERY))
137 137
 	{
138
-		LOG(L_CRIT, "alias_db:mod_init:  Database modules does not "
138
+		LM_CRIT("database modules does not "
139 139
 			"provide all functions needed by avpops module\n");
140 140
 		return -1;
141 141
 	}
... ...
@@ -58,7 +58,7 @@ static inline int rewrite_ruri(struct sip_msg* _m, char* _s)
58 58
 	
59 59
 	if (do_action(&act, _m) < 0)
60 60
 	{
61
-		LOG(L_ERR, "alias_db:rewrite_ruri: Error in do_action\n");
61
+		LM_ERR("do_action failed\n");
62 62
 		return -1;
63 63
 	}
64 64
 	return 0;
... ...
@@ -103,15 +103,15 @@ int alias_db_lookup(struct sip_msg* _msg, char* _table, char* _str2)
103 103
 	if(adbf.query(db_handle, db_keys, NULL, db_vals, db_cols,
104 104
 		(use_domain)?2:1 /*no keys*/, 2 /*no cols*/, NULL, &db_res)!=0)
105 105
 	{
106
-		LOG(L_ERR, "alias_db_lookup: error querying database\n");
106
+		LM_ERR("failed to query database\n");
107 107
 		goto err_server;
108 108
 	}
109 109
 
110 110
 	if (RES_ROW_N(db_res)<=0 || RES_ROWS(db_res)[0].values[0].nul != 0)
111 111
 	{
112
-		DBG("alias_db_lookup: no alias found for R-URI\n");
112
+		LM_DBG("no alias found for R-URI\n");
113 113
 		if (db_res!=NULL && adbf.free_result(db_handle, db_res) < 0)
114
-			DBG("alias_db_lookup: Error while freeing result of query\n");
114
+			LM_DBG("failed to freeing result of query\n");
115 115
 		return -1;
116 116
 	}
117 117
 
... ...
@@ -137,10 +137,10 @@ int alias_db_lookup(struct sip_msg* _msg, char* _table, char* _str2)
137 137
 				RES_ROWS(db_res)[0].values[0].val.blob_val.len);
138 138
 			user_s.len += RES_ROWS(db_res)[0].values[0].val.blob_val.len;
139 139
 		default:
140
-			LOG(L_ERR, "alias_db_lookup: Unknown type of DB user column\n");
140
+			LM_ERR("unknown type of DB user column\n");
141 141
 			if (db_res != NULL && adbf.free_result(db_handle, db_res) < 0)
142 142
 			{
143
-				DBG("alias_db_lookup: Error while freeing result of query\n");
143
+				LM_DBG("failed to freeing result of query\n");
144 144
 			}
145 145
 			goto err_server;
146 146
 	}
... ...
@@ -172,10 +172,10 @@ int alias_db_lookup(struct sip_msg* _msg, char* _table, char* _str2)
172 172
 			user_s.len += RES_ROWS(db_res)[0].values[1].val.blob_val.len;
173 173
 			useruri_buf[user_s.len] = '\0';
174 174
 		default:
175
-			LOG(L_ERR, "alias_db_lookup: Unknown type of DB user column\n");
175
+			LM_ERR("unknown type of DB user column\n");
176 176
 			if (db_res != NULL && adbf.free_result(db_handle, db_res) < 0)
177 177
 			{
178
-				DBG("alias_db_lookup: Error while freeing result of query\n");
178
+				LM_DBG("failed to freeing result of query\n");
179 179
 			}
180 180
 			goto err_server;
181 181
 	}
... ...
@@ -185,13 +185,13 @@ int alias_db_lookup(struct sip_msg* _msg, char* _table, char* _str2)
185 185
 	 * anymore
186 186
 	 */
187 187
 	if (db_res!=NULL && adbf.free_result(db_handle, db_res) < 0)
188
-		DBG("alias_db_lookup: Error while freeing result of query\n");
188
+		LM_DBG("failed to freeing result of query\n");
189 189
 
190 190
 	/* set the URI */
191
-	DBG("alias_db_lookup: URI of alias from R-URI [%s]\n", useruri_buf);
191
+	LM_DBG("the URI of alias from R-URI [%s]\n", useruri_buf);
192 192
 	if(rewrite_ruri(_msg, useruri_buf)<0)
193 193
 	{
194
-		LOG(L_ERR, "alias_db_lookup: Cannot replace the R-URI\n");
194
+		LM_ERR("cannot replace the R-URI\n");
195 195
 		goto err_server;
196 196
 	}
197 197
 
... ...
@@ -96,7 +96,7 @@ static inline int find_credentials(struct sip_msg* _m, str* _realm,
96 96
 	if (*hook == 0) {
97 97
 		/* No credentials parsed yet */
98 98
 		if (parse_headers(_m, hdr_flags, 0) == -1) {
99
-			LOG(L_ERR, "auth:find_credentials: Error while parsing headers\n");
99
+			LM_ERR("failed to parse headers\n");
100 100
 			return -1;
101 101
 		}
102 102
 	}
... ...
@@ -110,8 +110,7 @@ static inline int find_credentials(struct sip_msg* _m, str* _realm,
110 110
 	while(ptr) {
111 111
 		res = parse_credentials(ptr);
112 112
 		if (res < 0) {
113
-			LOG(L_ERR, 
114
-				"auth:find_credentials: Error while parsing credentials\n");
113
+			LM_ERR("failed to parse credentials\n");
115 114
 			return (res == -1) ? -2 : -3;
116 115
 		} else if (res == 0) {
117 116
 			r = &(((auth_body_t*)(ptr->parsed))->digest.realm);
... ...
@@ -126,7 +125,7 @@ static inline int find_credentials(struct sip_msg* _m, str* _realm,
126 126
 
127 127
 		prev = ptr;
128 128
 		if (parse_headers(_m, hdr_flags, 1) == -1) {
129
-			LOG(L_ERR, "auth:find_credentials: Error while parsing headers\n");
129
+			LM_ERR("failed to parse headers\n");
130 130
 			return -4;
131 131
 		} else {
132 132
 			if (prev != _m->last_header) {
... ...
@@ -167,9 +166,9 @@ auth_result_t pre_auth(struct sip_msg* _m, str* _realm, hdr_types_t _hftype,
167 167
 
168 168
 	if (_realm->len == 0) {
169 169
 		if (get_realm(_m, _hftype, &uri) < 0) {
170
-			LOG(L_ERR, "auth:pre_auth: Error while extracting realm\n");
170
+			LM_ERR("failed to extract realm\n");
171 171
 			if (send_resp(_m, 400, &auth_400_err, 0, 0) == -1) {
172
-				LOG(L_ERR, "auth:pre_auth: Error while sending 400 reply\n");
172
+				LM_ERR("failed to send 400 reply\n");
173 173
 			}
174 174
 			return ERROR;
175 175
 		}
... ...
@@ -184,14 +183,14 @@ auth_result_t pre_auth(struct sip_msg* _m, str* _realm, hdr_types_t _hftype,
184 184
 	 */
185 185
 	ret = find_credentials(_m, _realm, _hftype, _h);
186 186
 	if (ret < 0) {
187
-		LOG(L_ERR, "auth:pre_auth: Error while looking for credentials\n");
187
+		LM_ERR("failed to find credentials\n");
188 188
 		if (send_resp(_m, (ret == -2) ? 500 : 400, 
189 189
 			      (ret == -2) ? &auth_500_err : &auth_400_err, 0, 0) == -1) {
190
-			LOG(L_ERR, "auth:pre_auth: Error while sending 400 reply\n");
190
+			LM_ERR("failed to send 400 reply\n");
191 191
 		}
192 192
 		return ERROR;
193 193
 	} else if (ret > 0) {
194
-		DBG("auth:pre_auth: Credentials with given realm not found\n");
194
+		LM_DBG("credentials with given realm not found\n");
195 195
 		return NO_CREDENTIALS;
196 196
 	}
197 197
 
... ...
@@ -200,16 +199,15 @@ auth_result_t pre_auth(struct sip_msg* _m, str* _realm, hdr_types_t _hftype,
200 200
 
201 201
 	/* Check credentials correctness here */
202 202
 	if (check_dig_cred(&(c->digest)) != E_DIG_OK) {
203
-		LOG(L_ERR,
204
-			"auth:pre_auth: Credentials received are not filled properly\n");
203
+		LM_ERR("received credentials are not filled properly\n");
205 204
 		if (send_resp(_m, 400, &auth_400_err, 0, 0) == -1) {
206
-			LOG(L_ERR, "auth:pre_auth: Error while sending 400 reply\n");
205
+			LM_ERR("failed to send 400 reply\n");
207 206
 		}
208 207
 		return ERROR;
209 208
 	}
210 209
 
211 210
 	if (check_nonce(&c->digest.nonce, &secret) != 0) {
212
-		DBG("auth:pre_auth: Invalid nonce value received\n");
211
+		LM_DBG("invalid nonce value received\n");
213 212
 		return STALE_NONCE;
214 213
 	}
215 214
 
... ...
@@ -238,16 +236,16 @@ auth_result_t post_auth(struct sip_msg* _m, struct hdr_field* _h)
238 238
 			 * to be canceled)
239 239
 			 */
240 240
 		} else {
241
-			DBG("auth:post_auth: Response is OK, but nonce is stale\n");
241
+			LM_DBG("response is OK, but nonce is stale\n");
242 242
 			c->stale = 1;
243 243
 			res = STALE_NONCE;
244 244
 		}
245 245
 	}
246 246
 
247 247
 	if (mark_authorized_cred(_m, _h) < 0) {
248
-		LOG(L_ERR, "auth:post_auth: Error while marking parsed credentials\n");
248
+		LM_ERR("failed to mark parsed credentials\n");
249 249
 		if (send_resp(_m, 500, &auth_400_err, 0, 0) == -1) {
250
-			LOG(L_ERR, "auth:post_auth: Error while sending 500 reply\n");
250
+			LM_ERR("failed to send 500 reply\n");
251 251
 		}
252 252
 		res = ERROR;
253 253
 	}
... ...
@@ -264,7 +262,7 @@ int check_response(dig_cred_t* _cred, str* _method, char* _ha1)
264 264
 	 * the same length as responses created by us
265 265
 	 */
266 266
 	if (_cred->response.len != 32) {
267
-		DBG("auth:check_response: Receive response len != 32\n");
267
+		LM_DBG("receive response len != 32\n");
268 268
 		return 1;
269 269
 	}
270 270
 
... ...
@@ -277,17 +275,17 @@ int check_response(dig_cred_t* _cred, str* _method, char* _ha1)
277 277
 		&(_cred->qop.qop_str), _cred->qop.qop_parsed == QOP_AUTHINT,
278 278
 		_method, &(_cred->uri), hent, resp);
279 279
 	
280
-	DBG("auth:check_response: Our result = \'%s\'\n", resp);
280
+	LM_DBG("our result = \'%s\'\n", resp);
281 281
 	
282 282
 	/*
283 283
 	 * And simply compare the strings, the user is
284 284
 	 * authorized if they match
285 285
 	 */
286 286
 	if (!memcmp(resp, _cred->response.s, 32)) {
287
-		DBG("auth:check_response: Authorization is OK\n");
287
+		LM_DBG("authorization is OK\n");
288 288
 		return 0;
289 289
 	} else {
290
-		DBG("auth:check_response: Authorization failed\n");
290
+		LM_DBG("authorization failed\n");
291 291
 		return 2;
292 292
 	}
293 293
 }
... ...
@@ -297,7 +295,7 @@ int check_response(dig_cred_t* _cred, str* _method, char* _ha1)
297 297
 int bind_auth(auth_api_t* api)
298 298
 {
299 299
 	if (!api) {
300
-		LOG(L_ERR, "auth:bind_auth: Invalid parameter value\n");
300
+		LM_ERR("invalid parameter value\n");
301 301
 		return -1;
302 302
 	}
303 303
 
... ...
@@ -190,7 +190,7 @@ static inline int generate_random_secret(void)
190 190
 
191 191
 	sec_rand = (char*)pkg_malloc(RAND_SECRET_LEN);
192 192
 	if (!sec_rand) {
193
-		LOG(L_ERR, "ERROR:auth:generate_random_secret(): No pkg memory left\n");
193
+		LM_ERR("no pkg memory left\n");
194 194
 		return -1;
195 195
 	}
196 196
 
... ...
@@ -203,7 +203,7 @@ static inline int generate_random_secret(void)
203 203
 	secret.s = sec_rand;
204 204
 	secret.len = RAND_SECRET_LEN;
205 205
 
206
-	/*DBG("Generated secret: '%.*s'\n", secret.len, secret.s); */
206
+	/*LM_DBG("Generated secret: '%.*s'\n", secret.len, secret.s); */
207 207
 
208 208
 	return 0;
209 209
 }
... ...
@@ -212,11 +212,11 @@ static inline int generate_random_secret(void)
212 212
 static int mod_init(void)
213 213
 {
214 214
 	str stmp;
215
-	LOG(L_INFO,"AUTH module - initializing\n");
215
+	LM_INFO("initializing...\n");
216 216
 	
217 217
 	/* load the SL API */
218 218
 	if (load_sl_api(&slb)!=0) {
219
-		LOG(L_ERR, "ERROR:auth:mod_init: can't load SL API\n");
219
+		LM_ERR("can't load SL API\n");
220 220
 		return -1;
221 221
 	}
222 222
 
... ...
@@ -224,8 +224,7 @@ static int mod_init(void)
224 224
 	if (sec_param == 0) {
225 225
 		/* Generate secret using random generator */
226 226
 		if (generate_random_secret() < 0) {
227
-			LOG(L_ERR,"ERROR:auth:mod_init: Error while generating "
228
-				"random secret\n");
227
+			LM_ERR("failed to generate random secret\n");
229 228
 			return -3;
230 229
 		}
231 230
 	} else {
... ...
@@ -235,7 +234,7 @@ static int mod_init(void)
235 235
 	}
236 236
 
237 237
 	if ( init_rpid_avp(rpid_avp_param)<0 ) {
238
-		LOG(L_ERR,"ERROR:auth:mod_init: failed to process rpid AVPs\n");
238
+		LM_ERR("failed to process rpid AVPs\n");
239 239
 		return -4;
240 240
 	}
241 241
 
... ...
@@ -248,7 +247,7 @@ static int mod_init(void)
248 248
 		stmp.s = user_spec_param; stmp.len = strlen(stmp.s);
249 249
 		if(pv_parse_spec(&stmp, &user_spec)==NULL)
250 250
 		{
251
-			LOG(L_ERR,"ERROR:auth:mod_init: failed to parse username spec\n");
251
+			LM_ERR("failed to parse username spec\n");
252 252
 			return -5;
253 253
 		}
254 254
 		switch(user_spec.type) {
... ...
@@ -257,7 +256,7 @@ static int mod_init(void)
257 257
 			case PVT_NULL:
258 258
 			case PVT_MARKER:
259 259
 			case PVT_COLOR:
260
-				LOG(L_ERR,"ERROR:auth:mod_init: invalid username spec\n");
260
+				LM_ERR("invalid username spec\n");
261 261
 				return -6;
262 262
 			default: ;
263 263
 		}
... ...
@@ -267,7 +266,7 @@ static int mod_init(void)
267 267
 		stmp.s = passwd_spec_param; stmp.len = strlen(stmp.s);
268 268
 		if(pv_parse_spec(&stmp, &passwd_spec)==NULL)
269 269
 		{
270
-			LOG(L_ERR,"ERROR:auth:mod_init: failed to parse password spec\n");
270
+			LM_ERR("failed to parse password spec\n");
271 271
 			return -7;
272 272
 		}
273 273
 		switch(passwd_spec.type) {
... ...
@@ -276,7 +275,7 @@ static int mod_init(void)
276 276
 			case PVT_NULL:
277 277
 			case PVT_MARKER:
278 278
 			case PVT_COLOR:
279
-				LOG(L_ERR,"ERROR:auth:mod_init: invalid password spec\n");
279
+				LM_ERR("invalid password spec\n");
280 280
 				return -8;
281 281
 			default: ;
282 282
 		}
... ...
@@ -310,7 +309,7 @@ static inline int auth_get_ha1(struct sip_msg *msg, struct username* _username,
310 310
 		if(sval.rs.len!= _username->user.len
311 311
 				|| strncasecmp(sval.rs.s, _username->user.s, sval.rs.len))
312 312
 		{
313
-			DBG("auth: auth_get_ha1: username mismatch [%.*s] [%.*s]\n",
313
+			LM_DBG("username mismatch [%.*s] [%.*s]\n",
314 314
 				_username->user.len, _username->user.s, sval.rs.len, sval.rs.s);
315 315
 			pv_value_destroy(&sval);
316 316
 			return 1;
... ...
@@ -335,7 +334,7 @@ static inline int auth_get_ha1(struct sip_msg *msg, struct username* _username,
335 335
 		/* Only plaintext passwords are stored in database,
336 336
 		 * we have to calculate HA1 */
337 337
 		calc_HA1(HA_MD5, &_username->whole, _domain, &sval.rs, 0, 0, _ha1);
338
-		DBG("auth:auth_get_ha1: HA1 string calculated: %s\n", _ha1);
338
+		LM_DBG("HA1 string calculated: %s\n", _ha1);
339 339
 	} else {
340 340
 		memcpy(_ha1, sval.rs.s, sval.rs.len);
341 341
 		_ha1[sval.rs.len] = '\0';
... ...
@@ -356,7 +355,7 @@ static inline int pv_authorize(struct sip_msg* msg, pv_elem_t* realm,
356 356
 
357 357
 	if (realm) {
358 358
 		if (pv_printf_s(msg, realm, &domain)!=0) {
359
-			LOG(L_ERR, "ERROR:auth:authorize: pv_printf_s failed\n");
359
+			LM_ERR("pv_printf_s failed\n");
360 360
 			return AUTH_ERROR;
361 361
 		}
362 362
 	} else {
... ...
@@ -375,7 +374,7 @@ static inline int pv_authorize(struct sip_msg* msg, pv_elem_t* realm,
375 375
 	if (res < 0) {
376 376
 		/* Error */
377 377
 		if (slb.reply(msg, 500, &auth_500_err) == -1) {
378
-			LOG(L_ERR, "auth:authorize: Error while sending 500 reply\n");
378
+			LM_ERR("failed to send 500 reply\n");
379 379
 		}
380 380
 		return ERROR;
381 381
 	}
... ...
@@ -419,8 +418,7 @@ static int challenge_fixup(void** param, int param_no)
419 419
 		} else {
420 420
 			s.len = strlen(s.s);
421 421
 			if (pv_parse_format(&s,&model)<0) {
422
-				LOG(L_ERR, "ERROR:auth:challenge_fixup: pv_parse_format "
423
-					"failed\n");
422
+				LM_ERR("pv_parse_format failed\n");
424 423
 				return E_OUT_OF_MEM;
425 424
 			}
426 425
 		}
... ...
@@ -432,8 +430,7 @@ static int challenge_fixup(void** param, int param_no)
432 432
 			pkg_free(*param);
433 433
 			*param=(void*)qop;
434 434
 		} else {
435
-			LOG(L_ERR, "challenge_fixup(): Bad number <%s>\n",
436
-			    (char*)(*param));
435
+			LM_ERR("bad number <%s>\n", (char*)(*param));
437 436
 			return E_UNSPEC;
438 437
 		}
439 438
 	}
... ...
@@ -470,8 +467,7 @@ static int auth_fixup(void** param, int param_no)
470 470
 		} else {
471 471
 			s.len =  strlen(s.s);
472 472
 			if (pv_parse_format(&s,&model)<0) {
473
-				LOG(L_ERR, "ERROR:auth:auth_fixup: pv_parse_format "
474
-					"failed\n");
473
+				LM_ERR("pv_parse_format failed\n");
475 474
 				return E_OUT_OF_MEM;
476 475
 			}
477 476
 		}
... ...
@@ -97,7 +97,7 @@ static inline char *build_auth_hf(int _retries, int _stale, str* _realm,
97 97
 	
98 98
 	p=hf=pkg_malloc(*_len+1);
99 99
 	if (!hf) {
100
-		LOG(L_ERR, "ERROR: build_auth_hf: no memory\n");
100
+		LM_ERR("no pkg memory left\n");
101 101
 		*_len=0;
102 102
 		return 0;
103 103
 	}
... ...
@@ -123,7 +123,7 @@ static inline char *build_auth_hf(int _retries, int _stale, str* _realm,
123 123
 	memcpy(p, CRLF, CRLF_LEN ); p+=CRLF_LEN;
124 124
 	*p=0; /* zero terminator, just in case */
125 125
 	
126
-	DBG("build_auth_hf(): '%s'\n", hf);
126
+	LM_DBG("'%s'\n", hf);
127 127
 	return hf;
128 128
 }
129 129
 
... ...
@@ -158,9 +158,9 @@ static inline int challenge(struct sip_msg* _msg, pv_elem_t* _realm, int _qop,
158 158
 
159 159
 	if (_realm == 0) {
160 160
 		if (get_realm(_msg, hftype, &uri) < 0) {
161
-			LOG(L_ERR, "challenge(): Error while extracting URI\n");
161
+			LM_ERR("failed to extract URI\n");
162 162
 			if (send_resp(_msg, 400, &auth_400_err, 0, 0) == -1) {
163
-				LOG(L_ERR, "challenge(): Error while sending response\n");
163
+				LM_ERR("failed to send the response\n");
164