[Tarantool-patches] [PATCH 05/13] say: allow to set a logger file descriptor

Alexander Turenko alexander.turenko at tarantool.org
Fri Apr 10 05:50:43 MSK 2020


It is necessary to decouple stderr from a logger file descriptor in the
popen implementation.

Part of #4031
---
 src/lib/core/say.c | 6 ++++++
 src/lib/core/say.h | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/lib/core/say.c b/src/lib/core/say.c
index dd05285a6..5d572e1ab 100644
--- a/src/lib/core/say.c
+++ b/src/lib/core/say.c
@@ -174,6 +174,12 @@ log_get_fd(void)
 	return log_default->fd;
 }
 
+void
+log_set_fd(int new_fd)
+{
+	log_default->fd = new_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 e17de659c..3ce7724c4 100644
--- a/src/lib/core/say.h
+++ b/src/lib/core/say.h
@@ -204,10 +204,15 @@ enum say_logger_type
 log_type();
 
 /**
- * Default logger file descriptor.
+ * Accessors for default logger file descriptor.
+ *
+ * It is needed for dark magic inside popen implementation.
+ * Unlikely it is what you want to use anywhere else.
  */
 int
 log_get_fd(void);
+void
+log_set_fd(int new_fd);
 
 /**
  * Set log level. Can be used dynamically.
-- 
2.25.0



More information about the Tarantool-patches mailing list