add storage access log header

pull/56/merge
yuqing 2017-05-25 11:03:30 +08:00
parent 3dce9275c3
commit 7042f8d061
2 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,7 @@
Version 5.11 2017-04-28
Version 5.11 2017-05-25
* bug fixed: file_offset has no effect when use trunk file
* add storage access log header
Version 5.10 2017-03-29
* use fc_safe_read instead of read, and fc_safe_write instead of write

View File

@ -1041,6 +1041,14 @@ static int storage_load_paths(IniContext *pItemContext)
return 0;
}
void storage_set_access_log_header(struct log_context *pContext)
{
#define STORAGE_ACCESS_HEADER_STR "client_ip action filename status time_used_ms req_len resp_len"
#define STORAGE_ACCESS_HEADER_LEN (sizeof(STORAGE_ACCESS_HEADER_STR) - 1)
log_header(pContext, STORAGE_ACCESS_HEADER_STR, STORAGE_ACCESS_HEADER_LEN);
}
int storage_func_init(const char *filename, \
char *bind_addr, const int addr_size)
{
@ -1655,6 +1663,7 @@ int storage_func_init(const char *filename, \
{
break;
}
log_set_header_callback(&g_access_log_context, storage_set_access_log_header);
}
g_rotate_access_log = iniGetBoolValue(NULL, "rotate_access_log",\