aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/telnet_interface.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@netfilter.org>2009-12-17 23:10:46 +0100
committerHarald Welte <laforge@netfilter.org>2009-12-17 23:10:46 +0100
commitb1d4c8ed9d2b4ecb76355d71a152c22934c48504 (patch)
treeadc7234f321e78f2ca9046d9d3cfc5933b9c1a29 /openbsc/src/telnet_interface.c
parent66706812514c4baca743ad3a07e4556d48b6cded (diff)
logging: introduce log levels at caller site
This introduces a new LOGP() macro together with LOGL_* definition to support multiple log levels (severities) throughout the codebase. Please note that the actual logging system does not use them yet, in this patch we simply introduce the new macros at the caller site.
Diffstat (limited to 'openbsc/src/telnet_interface.c')
-rw-r--r--openbsc/src/telnet_interface.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/openbsc/src/telnet_interface.c b/openbsc/src/telnet_interface.c
index 128c34e94..2d7b05c70 100644
--- a/openbsc/src/telnet_interface.c
+++ b/openbsc/src/telnet_interface.c
@@ -35,6 +35,7 @@
#include <openbsc/paging.h>
#include <openbsc/signal.h>
#include <openbsc/talloc.h>
+#include <openbsc/debug.h>
#include <vty/buffer.h>
@@ -71,7 +72,7 @@ void telnet_init(struct gsm_network *network, int port) {
fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (fd < 0) {
- perror("Telnet interface socket creation failed");
+ LOGP(DNM, LOGL_ERROR, "Telnet interface socket creation failed\n");
return;
}
@@ -83,12 +84,12 @@ void telnet_init(struct gsm_network *network, int port) {
sock_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
if (bind(fd, (struct sockaddr*)&sock_addr, sizeof(sock_addr)) < 0) {
- perror("Telnet interface failed to bind");
+ LOGP(DNM, LOG_ERROR, "Telnet interface failed to bind\n");
return;
}
if (listen(fd, 0) < 0) {
- perror("Telnet interface failed to listen");
+ LOGP(DNM, LOG_ERROR, "Telnet interface failed to listen\n");
return;
}
@@ -154,7 +155,7 @@ static int telnet_new_connection(struct bsc_fd *fd, unsigned int what) {
int new_connection = accept(fd->fd, (struct sockaddr*)&sockaddr, &len);
if (new_connection < 0) {
- perror("telnet accept failed");
+ LOGP(DNM, LOGL_ERROR, "telnet accept failed\n");
return -1;
}
@@ -171,8 +172,10 @@ static int telnet_new_connection(struct bsc_fd *fd, unsigned int what) {
print_welcome(new_connection);
connection->vty = vty_create(new_connection, connection);
- if (!connection->vty)
+ if (!connection->vty) {
+ LOGP(DNM, LOGL_ERROR, "couldn't create VTY\n");
return -1;
+ }
return 0;
}