From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id E78AE2871A for ; Sat, 2 Mar 2019 12:29:49 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hdwLkvYlRdW9 for ; Sat, 2 Mar 2019 12:29:49 -0500 (EST) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 606AD28716 for ; Sat, 2 Mar 2019 12:29:49 -0500 (EST) From: Roman Khabibov Subject: [tarantool-patches] [PATCH] log: add missing assert into log_set_format() Date: Sat, 2 Mar 2019 20:29:46 +0300 Message-Id: <20190302172946.94121-1-roman.habibov@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org 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)