From: Vladimir Davydov <vdavydov.dev@gmail.com> To: Roman Khabibov <roman.habibov@tarantool.org> Cc: tarantool-patches@freelists.org, v.shpilevoy@tarantool.org Subject: Re: [tarantool-patches] [PATCH] log: add missing assert into log_set_format() Date: Tue, 5 Mar 2019 17:21:40 +0300 [thread overview] Message-ID: <20190305142140.3mguirkwwsk3waho@esperanza> (raw) In-Reply-To: <20190302172946.94121-1-roman.habibov@tarantool.org> On Sat, Mar 02, 2019 at 08:29:46PM +0300, Roman Khabibov wrote: > Add missing condition for json format into assert in log_set_format() function. > > Closes #3946 > --- > > Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-3946-log-assert/test > Issue: https://github.com/tarantool/tarantool/issues/3946 > > src/lib/core/say.c | 3 ++- > test/app-tap/logger.test.lua | 6 +++++- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/src/lib/core/say.c b/src/lib/core/say.c > index 50ee55692..758b1c234 100644 > --- a/src/lib/core/say.c > +++ b/src/lib/core/say.c > @@ -170,7 +170,8 @@ log_set_level(struct log *log, enum say_level level) > void > log_set_format(struct log *log, log_format_func_t format_func) > { > - assert(format_func == say_format_plain || > + assert(format_func == say_format_json || > + format_func == say_format_plain || > log->type == SAY_LOGGER_STDERR || > log->type == SAY_LOGGER_PIPE || log->type == SAY_LOGGER_FILE); The assertion is meaningless after this change. At least the log->type check. I guess the idea was to check that json format isn't used in conjunction with syslog. Also, there's another similar assertion failure that I think should be fixed in the scope of this patch: box.cfg{log = 'syslog:identity=tarantool'} require('log').log_format('json') tarantool: /home/vlad/src/tarantool/src/lib/core/say.c:195: say_set_log_format: Assertion `log_default->type != SAY_LOGGER_SYSLOG' failed. > > diff --git a/test/app-tap/logger.test.lua b/test/app-tap/logger.test.lua > index 0c11702c8..4e18d53e9 100755 > --- a/test/app-tap/logger.test.lua > +++ b/test/app-tap/logger.test.lua > @@ -1,13 +1,17 @@ > #!/usr/bin/env tarantool > > local test = require('tap').test('log') > -test:plan(24) > +test:plan(25) > > -- > -- Check that Tarantool creates ADMIN session for #! script > -- > local filename = "1.log" > local message = "Hello, World!" > + > +jlog = require('log') > +test:ok(jlog.log_format("json") == nil, "no assertions") > + Squeezing a test case like this, without a proper comment, looks bad - it seems that the comment above is related to it although it isn't. Also, jlog is a bad name. If you don't want to pollute the namespace, you can get along without it: require('log').log_format('json') > box.cfg{ > log=filename, > memtx_memory=107374182,
next prev parent reply other threads:[~2019-03-05 14:21 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-03-02 17:29 Roman Khabibov 2019-03-05 14:21 ` Vladimir Davydov [this message] 2019-03-18 15:35 ` [tarantool-patches] " Roman Khabibov 2019-03-19 8:30 ` Vladimir Davydov 2019-03-25 12:43 ` [tarantool-patches] " Roman Khabibov 2019-03-25 13:03 ` Roman Khabibov 2019-03-26 17:26 ` Vladimir Davydov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190305142140.3mguirkwwsk3waho@esperanza \ --to=vdavydov.dev@gmail.com \ --cc=roman.habibov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [tarantool-patches] [PATCH] log: add missing assert into log_set_format()' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox