提交 d88e9a64 编写于 作者: Y yuqing

add function log_reopen_ex

上级 118f657c
Version 1.06 2014-08-25
Version 1.06 2014-08-26
* update source code from FastDFS V5.02
* add function short2buff and buff2short
* add object memory pool (fast_mblock.h and fast_mblock.c)
......@@ -23,6 +23,7 @@ Version 1.06 2014-08-25
* socket send and recv ignore erno EINTR
* http_parse_query_ex support binary buffer, and set both lengths of key and name
* add function ioevent_remove
* add function log_reopen_ex
Version 1.05 2012-07-08
* update source code from FastDFS V3.09
......
......@@ -147,6 +147,20 @@ static int log_open(LogContext *pContext)
return 0;
}
int log_reopen_ex(LogContext *pContext)
{
if (*(pContext->log_filename) == '\0')
{
return ENOENT;
}
if (pContext->log_fd >= 0 && pContext->log_fd != STDERR_FILENO)
{
close(pContext->log_fd);
}
return log_open(pContext);
}
int log_set_prefix_ex(LogContext *pContext, const char *base_path, \
const char *filename_prefix)
{
......
......@@ -99,6 +99,8 @@ int log_init();
*/
int log_init2();
#define log_reopen() log_reopen_ex(&g_log_context)
#define log_set_prefix(base_path, filename_prefix) \
log_set_prefix_ex(&g_log_context, base_path, filename_prefix)
......@@ -119,6 +121,13 @@ int log_init2();
*/
int log_init_ex(LogContext *pContext);
/** reopen the log file
* parameters:
* pContext: the log context
* return: 0 for success, != 0 fail
*/
int log_reopen_ex(LogContext *pContext);
/** set log filename prefix, such as "tracker", the log filename will be
* ${base_path}/logs/tracker.log
* parameters:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册