Tarantool development patches archive
 help / color / mirror / Atom feed
From: Roman Khabibov <roman.habibov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org
Subject: [tarantool-patches] [PATCH] log: add missing assert into log_set_format()
Date: Sat,  2 Mar 2019 20:29:46 +0300	[thread overview]
Message-ID: <20190302172946.94121-1-roman.habibov@tarantool.org> (raw)

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);
 
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")
+
 box.cfg{
     log=filename,
     memtx_memory=107374182,
-- 
2.17.2 (Apple Git-113)

             reply	other threads:[~2019-03-02 17:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-02 17:29 Roman Khabibov [this message]
2019-03-05 14:21 ` Vladimir Davydov
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=20190302172946.94121-1-roman.habibov@tarantool.org \
    --to=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