Index: pjproject/trunk/pjnath/src/pjnath/errno.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/errno.c	(revision 5982)
+++ pjproject/trunk/pjnath/src/pjnath/errno.c	(revision 5983)
@@ -194,18 +194,14 @@
 			   pj_status_t status)
 {
-    char errmsg[PJ_ERR_MSG_SIZE];
-
-    pj_strerror(status, errmsg, sizeof(errmsg));
-
 #if PJNATH_ERROR_LEVEL==1
-    PJ_LOG(1,(sender, "%s: %s", title, errmsg));
+    PJ_PERROR(1,(sender, status, title));
 #elif PJNATH_ERROR_LEVEL==2
-    PJ_LOG(2,(sender, "%s: %s", title, errmsg));
+    PJ_PERROR(2,(sender, status, title));
 #elif PJNATH_ERROR_LEVEL==3
-    PJ_LOG(3,(sender, "%s: %s", title, errmsg));
+    PJ_PERROR(3,(sender, status, title));
 #elif PJNATH_ERROR_LEVEL==4
-    PJ_LOG(4,(sender, "%s: %s", title, errmsg));
+    PJ_PERROR(4,(sender, status, title));
 #elif PJNATH_ERROR_LEVEL==5
-    PJ_LOG(5,(sender, "%s: %s", title, errmsg));
+    PJ_PERROR(5,(sender, status, title));
 #else
 # error Invalid PJNATH_ERROR_LEVEL value
Index: pjproject/trunk/pjnath/src/pjnath/ice_strans.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/ice_strans.c	(revision 5982)
+++ pjproject/trunk/pjnath/src/pjnath/ice_strans.c	(revision 5983)
@@ -959,8 +959,6 @@
 		      const char *title, pj_status_t status)
 {
-    char errmsg[PJ_ERR_MSG_SIZE];
-
-    pj_strerror(status, errmsg, sizeof(errmsg));
-    PJ_LOG(4,(ice_st->obj_name, "%s: %s", title, errmsg));
+    PJ_PERROR(4,(ice_st->obj_name, status, title));
+
     pj_log_push_indent();
 
@@ -1588,9 +1586,7 @@
     if (cb.on_ice_complete) {
 	if (status != PJ_SUCCESS) {
-	    char errmsg[PJ_ERR_MSG_SIZE];
-	    pj_strerror(status, errmsg, sizeof(errmsg));
-	    PJ_LOG(4,(ice_st->obj_name,
-		      "ICE negotiation failed after %ds:%03d: %s",
-		      msec/1000, msec%1000, errmsg));
+	    PJ_PERROR(4,(ice_st->obj_name, status,
+			 "ICE negotiation failed after %ds:%03d",
+			 msec/1000, msec%1000));
 	} else {
 	    unsigned i;
Index: pjproject/trunk/pjnath/src/pjnath/nat_detect.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/nat_detect.c	(revision 5982)
+++ pjproject/trunk/pjnath/src/pjnath/nat_detect.c	(revision 5983)
@@ -582,6 +582,6 @@
     }
 
-    PJ_LOG(5,(sess->pool->obj_name, "Completed %s, status=%d",
-	      test_names[test_id], status));
+    PJ_PERROR(5,(sess->pool->obj_name, status, "Completed %s",
+		 test_names[test_id]));
 
     sess->result[test_id].complete = PJ_TRUE;
Index: pjproject/trunk/pjnath/src/pjnath/stun_session.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/stun_session.c	(revision 5982)
+++ pjproject/trunk/pjnath/src/pjnath/stun_session.c	(revision 5983)
@@ -1221,5 +1221,5 @@
 					  &response);
     if (status != PJ_SUCCESS && response != NULL) {
-	PJ_LOG(5,(SNAME(sess), "Message authentication failed"));
+	PJ_PERROR(5,(SNAME(sess), status, "Message authentication failed"));
 	send_response(sess, token, tmp_pool, response, &rdata->info, 
 		      PJ_FALSE, src_addr, src_addr_len);
@@ -1263,6 +1263,6 @@
 					       &tdata->auth_info.auth_key);
 	if (status != PJ_SUCCESS) {
-	    PJ_LOG(5,(SNAME(sess), 
-		      "Response authentication failed"));
+	    PJ_PERROR(5,(SNAME(sess), status,
+			 "Response authentication failed"));
 	    return status;
 	}
Index: pjproject/trunk/pjnath/src/pjnath/stun_sock.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/stun_sock.c	(revision 5982)
+++ pjproject/trunk/pjnath/src/pjnath/stun_sock.c	(revision 5983)
@@ -244,6 +244,6 @@
 					  PJ_TRUE, &sobuf_size);
 	if (status != PJ_SUCCESS) {
-	    pj_perror(3, stun_sock->obj_name, status,
-		      "Failed setting SO_RCVBUF");
+	    PJ_PERROR(3, (stun_sock->obj_name, status,
+			  "Failed setting SO_RCVBUF"));
 	} else {
 	    if (sobuf_size < cfg->so_rcvbuf_size) {
@@ -263,6 +263,6 @@
 					  PJ_TRUE, &sobuf_size);
 	if (status != PJ_SUCCESS) {
-	    pj_perror(3, stun_sock->obj_name, status,
-		      "Failed setting SO_SNDBUF");
+	    PJ_PERROR(3, (stun_sock->obj_name, status,
+			  "Failed setting SO_SNDBUF"));
 	} else {
 	    if (sobuf_size < cfg->so_sndbuf_size) {
Index: pjproject/trunk/pjnath/src/pjnath/turn_session.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/turn_session.c	(revision 5982)
+++ pjproject/trunk/pjnath/src/pjnath/turn_session.c	(revision 5983)
@@ -1933,7 +1933,6 @@
 					PJ_STUN_MAGIC, NULL, &tdata);
 		    if (status != PJ_SUCCESS) {
-			PJ_LOG(1,(sess->obj_name, 
-				 "Error creating CreatePermission request: %d",
-				 status));
+			PJ_PERROR(1,(sess->obj_name, status,
+				  "Error creating CreatePermission request"));
 			return 0;
 		    }
@@ -1978,7 +1977,6 @@
 					  tdata);
 	if (status != PJ_SUCCESS) {
-	    PJ_LOG(1,(sess->obj_name, 
-		      "Error sending CreatePermission request: %d",
-		      status));
+	    PJ_PERROR(1,(sess->obj_name, status,
+		      "Error sending CreatePermission request"));
 	    count = 0;
 	}
Index: pjproject/trunk/pjnath/src/pjnath/turn_sock.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/turn_sock.c	(revision 5982)
+++ pjproject/trunk/pjnath/src/pjnath/turn_sock.c	(revision 5983)
@@ -835,6 +835,6 @@
 					      PJ_TRUE, &sobuf_size);
 	    if (status != PJ_SUCCESS) {
-		pj_perror(3, turn_sock->obj_name, status,
-			  "Failed setting SO_RCVBUF");
+		PJ_PERROR(3, (turn_sock->obj_name, status,
+			      "Failed setting SO_RCVBUF"));
 	    } else {
 		if (sobuf_size < turn_sock->setting.so_rcvbuf_size) {
@@ -854,6 +854,6 @@
 					      PJ_TRUE, &sobuf_size);
 	    if (status != PJ_SUCCESS) {
-		pj_perror(3, turn_sock->obj_name, status,
-			  "Failed setting SO_SNDBUF");
+		PJ_PERROR(3, (turn_sock->obj_name, status,
+			      "Failed setting SO_SNDBUF"));
 	    } else {
 		if (sobuf_size < turn_sock->setting.so_sndbuf_size) {
@@ -905,8 +905,8 @@
 	    on_connect_complete(turn_sock->active_sock, PJ_SUCCESS);
 	} else if (status != PJ_EPENDING) {
-            pj_perror(3, turn_sock->pool->obj_name, status,
-                      "Failed to connect to %s",
-                      pj_sockaddr_print(&info.server, addrtxt,
-                                        sizeof(addrtxt), 3));
+            PJ_PERROR(3, (turn_sock->pool->obj_name, status,
+			  "Failed to connect to %s",
+			  pj_sockaddr_print(&info.server, addrtxt,
+					    sizeof(addrtxt), 3)));
 	    pj_turn_sock_destroy(turn_sock);
 	    return;
