[Tarantool-patches] [PATCH 1/7] core/say: Export logger fd

Cyrill Gorcunov gorcunov at gmail.com
Mon Mar 2 23:12:21 MSK 2020


We need it inside popen engine to be able to print
errors from inside of a child process.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 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



More information about the Tarantool-patches mailing list