ns2: Unify logging context via log macros

Let's avoid open-coding the printing of log context and rather rely on
log macros to prefix each log line with the relevant context.  This
helps log readability, log post processing whether by grep or more
sophisticated tools.

Change-Id: I946c0e77686d91efc5afb62031e1ac1033a9a586
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index ebb2e3b..7183bd8 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -8,6 +8,24 @@
 #include <osmocom/gprs/protocol/gsm_08_16.h>
 #include <osmocom/gprs/gprs_ns2.h>
 
+#define LOGNSE(nse, lvl, fmt, args ...) \
+	LOGP(DLNS, lvl, "NSE(%05u) " fmt, (nse)->nsei, ## args)
+
+#define LOGBIND(bind, lvl, fmt, args ...) \
+	LOGP(DLNS, lvl, "BIND(%s) " fmt, (bind)->name, ## args)
+
+
+#define LOGNSVC(nsvc, lvl, fmt, args ...)					\
+	do {									\
+		if ((nsvc)->nsvci_is_valid) {					\
+			LOGP(DLNS, lvl, "NSE(%05u)-NSVC(%05u) " fmt,		\
+			     (nsvc)->nse->nsei, (nsvc)->nsvci, ## args);	\
+		} else { 							\
+			LOGP(DLNS, lvl, "NSE(%05u)-NSVC(none) " fmt, 		\
+			     (nsvc)->nse->nsei, ## args);			\
+		}								\
+	} while (0)
+
 struct osmo_fsm_inst;
 struct tlv_parsed;
 struct vty;