From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 4A6D0469719 for ; Mon, 2 Mar 2020 23:12:43 +0300 (MSK) Received: by mail-lj1-f193.google.com with SMTP id a12so933436ljj.2 for ; Mon, 02 Mar 2020 12:12:43 -0800 (PST) From: Cyrill Gorcunov Date: Mon, 2 Mar 2020 23:12:21 +0300 Message-Id: <20200302201227.31785-2-gorcunov@gmail.com> In-Reply-To: <20200302201227.31785-1-gorcunov@gmail.com> References: <20200302201227.31785-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 1/7] core/say: Export logger fd List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml We need it inside popen engine to be able to print errors from inside of a child process. Signed-off-by: Cyrill Gorcunov --- src/lib/core/say.c | 6 ++++++ src/lib/core/say.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/lib/core/say.c b/src/lib/core/say.c index 64a637c58..dd05285a6 100644 --- a/src/lib/core/say.c +++ b/src/lib/core/say.c @@ -168,6 +168,12 @@ log_type() return log_default->type; } +int +log_get_fd(void) +{ + return log_default->fd; +} + void log_set_level(struct log *log, enum say_level level) { diff --git a/src/lib/core/say.h b/src/lib/core/say.h index d26c3ddef..e17de659c 100644 --- a/src/lib/core/say.h +++ b/src/lib/core/say.h @@ -144,6 +144,7 @@ typedef int (*log_format_func_t)(struct log *log, char *buf, int len, int level, * A log object. There is a singleton for the default log. */ struct log { + /** The current file descriptor. */ int fd; /** The current log level. */ int level; @@ -202,6 +203,12 @@ log_say(struct log *log, int level, const char *filename, enum say_logger_type log_type(); +/** + * Default logger file descriptor. + */ +int +log_get_fd(void); + /** * Set log level. Can be used dynamically. * -- 2.20.1