This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/20303 ) Change subject: logging: Add 'length' argument to target->output() function ...................................................................... logging: Add 'length' argument to target->output() function Pass the length of the formatted log string to the output callback function, in case it may need it. Change-Id: I0a92239831fe3d8a49a31b59073f7eb2e7e70ce6 --- M include/osmocom/core/logging.h M src/logging.c M src/logging_syslog.c M src/loggingrb.c M src/vty/logging_vty.c 5 files changed, 7 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/03/20303/1 diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h index 36ce941..318f75b 100644 --- a/include/osmocom/core/logging.h +++ b/include/osmocom/core/logging.h @@ -318,9 +318,10 @@ * \param[in] target logging target * \param[in] level log level of currnet message * \param[in] string the string that is to be written to the log + * \param[in] len the length of 'string' in octets */ void (*output) (struct log_target *target, unsigned int level, - const char *string); + const char *string, int len); /*! alternative call-back function to which the logging * framework passes the unfortmatted input arguments, diff --git a/src/logging.c b/src/logging.c index 212b0b9..8f8c33d 100644 --- a/src/logging.c +++ b/src/logging.c @@ -518,7 +518,7 @@ } err: buf[sizeof(buf)-1] = '\0'; - target->output(target, level, buf); + target->output(target, level, buf, len); } /* Catch internal logging category indexes as well as out-of-bounds indexes. @@ -832,7 +832,7 @@ #if (!EMBEDDED) static void _file_output(struct log_target *target, unsigned int level, - const char *log) + const char *log, int len) { fprintf(target->tgt_file.out, "%s", log); fflush(target->tgt_file.out); diff --git a/src/logging_syslog.c b/src/logging_syslog.c index f980689..fa457a2 100644 --- a/src/logging_syslog.c +++ b/src/logging_syslog.c @@ -58,8 +58,7 @@ return LOG_DEBUG; } -static void _syslog_output(struct log_target *target, - unsigned int level, const char *log) +static void _syslog_output(struct log_target *target, unsigned int level, const char *log, int len) { syslog(logp2syslog_level(level), "%s", log); } diff --git a/src/loggingrb.c b/src/loggingrb.c index 4a80cc8..caf6e1d 100644 --- a/src/loggingrb.c +++ b/src/loggingrb.c @@ -37,8 +37,7 @@ #include <osmocom/core/logging.h> #include <osmocom/core/loggingrb.h> -static void _rb_output(struct log_target *target, - unsigned int level, const char *log) +static void _rb_output(struct log_target *target, unsigned int level, const char *log, int len) { osmo_strrb_add(target->tgt_rb.rb, log); } diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index bd513e3..10346d1 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -79,8 +79,7 @@ * */ -static void _vty_output(struct log_target *tgt, - unsigned int level, const char *line) +static void _vty_output(struct log_target *tgt, unsigned int level, const char *line, int len) { struct vty *vty = tgt->tgt_vty.vty; vty_out(vty, "%s", line); -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20303 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I0a92239831fe3d8a49a31b59073f7eb2e7e70ce6 Gerrit-Change-Number: 20303 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200927/65b2e25b/attachment.htm>