summaryrefslogtreecommitdiff
path: root/src/core/dialer.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-04-21 12:23:07 -0700
committerGitHub <noreply@github.com>2024-04-21 12:23:07 -0700
commit56507ab5c4db009be5251bde832f594fe5ed3d5e (patch)
treec70e7d669c3548a5c58ab27c0fc6118a96580863 /src/core/dialer.c
parent3593eba5272bf627b99a2521b3f025141a49bcad (diff)
downloadnng-56507ab5c4db009be5251bde832f594fe5ed3d5e.tar.gz
nng-56507ab5c4db009be5251bde832f594fe5ed3d5e.tar.bz2
nng-56507ab5c4db009be5251bde832f594fe5ed3d5e.zip
Logging improvements (#1816)
* Add nng_str_sockaddr to get string representation of socket address. * Added nng_log_get_level() is meant to allow users to obtain the current level and avoid some possibly expensive operations just to collect debugging information when debugging is not in effect. We use a custom logger for NUTS, and this fits within the NUTS test framework well, so that if -v is supplied we get more content. All tests now get this by default.
Diffstat (limited to 'src/core/dialer.c')
-rw-r--r--src/core/dialer.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/dialer.c b/src/core/dialer.c
index ed8577dc..722a0868 100644
--- a/src/core/dialer.c
+++ b/src/core/dialer.c
@@ -1,5 +1,5 @@
//
-// Copyright 2023 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
// Copyright 2018 Devolutions <info@devolutions.net>
//
@@ -388,8 +388,10 @@ dialer_connect_cb(void *arg)
case NNG_ECONNREFUSED:
case NNG_ETIMEDOUT:
default:
- nng_log_warn("NNG-CONN-FAIL", "Failed connecting to %s: %s",
- d->d_url->u_rawurl, nng_strerror(rv));
+ nng_log_warn("NNG-CONN-FAIL",
+ "Failed connecting socket<%u> to %s: %s",
+ nni_sock_id(d->d_sock), d->d_url->u_rawurl,
+ nng_strerror(rv));
nni_dialer_bump_error(d, rv);
if (user_aio == NULL) {
@@ -441,6 +443,9 @@ nni_dialer_start(nni_dialer *d, unsigned flags)
nni_aio_free(aio);
}
+ nng_log_info("NNG-DIAL", "Starting dialer for socket<%u> on %s",
+ nni_sock_id(d->d_sock), d->d_url->u_rawurl);
+
return (rv);
}