diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2016-04-05 11:12:44 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2016-04-05 11:12:44 +0300 |
commit | 101ae68a9fbe5f0a3d3426ff1a9fb0f763596cc7 (patch) | |
tree | ab62ab2edbf98f3a98989cacebeb878672d86cef /accel-pppd/logs | |
parent | a730a45b5a3325d62ff5cdb3a7782fc258331033 (diff) | |
download | accel-ppp-101ae68a9fbe5f0a3d3426ff1a9fb0f763596cc7.tar.gz accel-ppp-101ae68a9fbe5f0a3d3426ff1a9fb0f763596cc7.zip |
improved logging: if session's interface is empty log ctrl's interface
Diffstat (limited to 'accel-pppd/logs')
-rw-r--r-- | accel-pppd/logs/log_file.c | 2 | ||||
-rw-r--r-- | accel-pppd/logs/log_syslog.c | 2 | ||||
-rw-r--r-- | accel-pppd/logs/log_tcp.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/accel-pppd/logs/log_file.c b/accel-pppd/logs/log_file.c index 30bfde46..6eafd420 100644 --- a/accel-pppd/logs/log_file.c +++ b/accel-pppd/logs/log_file.c @@ -245,7 +245,7 @@ static void set_hdr(struct log_msg_t *msg, struct ap_session *ses) strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S", &tm); sprintf(msg->hdr->msg, "%s[%s]: %s: %s%s%s", conf_color ? level_color[msg->level] : "", timestamp, level_name[msg->level], - ses ? ses->ifname : "", + ses ? (ses->ifname[0] ? ses->ifname : ses->ctrl->ifname) : "", ses ? ": " : "", conf_color ? NORMAL_COLOR : ""); msg->hdr->len = strlen(msg->hdr->msg); diff --git a/accel-pppd/logs/log_syslog.c b/accel-pppd/logs/log_syslog.c index 36c8775b..562d895f 100644 --- a/accel-pppd/logs/log_syslog.c +++ b/accel-pppd/logs/log_syslog.c @@ -53,7 +53,7 @@ static void unpack_msg(struct log_msg_t *msg) static void set_hdr(struct log_msg_t *msg, struct ap_session *ses) { if (ses) { - if (snprintf(msg->hdr->msg, LOG_CHUNK_SIZE, "%s:%s: ", ses->ifname, ses->username ? ses->username : "")) + if (snprintf(msg->hdr->msg, LOG_CHUNK_SIZE, "%s:%s: ", ses->ifname[0] ? ses->ifname : ses->ctrl->ifname, ses->username ? ses->username : "")) strcpy(msg->hdr->msg + LOG_CHUNK_SIZE - 3, ": "); } else msg->hdr->msg[0] = 0; diff --git a/accel-pppd/logs/log_tcp.c b/accel-pppd/logs/log_tcp.c index 616809f0..85edf70a 100644 --- a/accel-pppd/logs/log_tcp.c +++ b/accel-pppd/logs/log_tcp.c @@ -137,7 +137,7 @@ static void set_hdr(struct log_msg_t *msg, struct ap_session *ses) localtime_r(&msg->timestamp.tv_sec, &tm); strftime(timestamp, sizeof(timestamp), "%Y-%m-%d %H:%M:%S", &tm); - sprintf(msg->hdr->msg, "[%s]: %s: %s: ", timestamp, level_name[msg->level], ses ? ses->ifname : ""); + sprintf(msg->hdr->msg, "[%s]: %s: %s: ", timestamp, level_name[msg->level], ses ? (ses->ifname[0] ? ses->ifname : ses->ctrl->ifname) : ""); msg->hdr->len = strlen(msg->hdr->msg); } |