Kouhei Sutou
null+****@clear*****
Fri Apr 17 18:23:37 JST 2015
Kouhei Sutou 2015-04-17 18:23:37 +0900 (Fri, 17 Apr 2015) New Revision: b9b773b5ca87896d769e1d8666c80d4f2f92e728 https://github.com/groonga/groonga/commit/b9b773b5ca87896d769e1d8666c80d4f2f92e728 Message: Add APIs to change log rotate threshold in file size New APIs: * grn_default_logger_set_rotate_threshold_size() * grn_default_logger_get_rotate_threshold_size() * grn_default_query_logger_set_rotate_threshold_size() * grn_default_query_logger_get_rotate_threshold_size() Modified files: include/groonga/groonga.h lib/logger.c Modified: include/groonga/groonga.h (+4 -0) =================================================================== --- include/groonga/groonga.h 2015-04-17 18:09:59 +0900 (08e8dd5) +++ include/groonga/groonga.h 2015-04-17 18:23:37 +0900 (c949ea2) @@ -1174,6 +1174,8 @@ GRN_API void grn_default_logger_set_max_level(grn_log_level level); GRN_API grn_log_level grn_default_logger_get_max_level(void); GRN_API void grn_default_logger_set_path(const char *path); GRN_API const char *grn_default_logger_get_path(void); +GRN_API void grn_default_logger_set_rotate_threshold_size(long long unsigned int threshold); +GRN_API long long unsigned int grn_default_logger_get_rotate_threshold_size(void); #define GRN_LOG(ctx,level,...) do {\ if (grn_logger_pass(ctx, level)) {\ @@ -1206,6 +1208,8 @@ GRN_API void grn_default_query_logger_set_flags(unsigned int flags); GRN_API unsigned int grn_default_query_logger_get_flags(void); GRN_API void grn_default_query_logger_set_path(const char *path); GRN_API const char *grn_default_query_logger_get_path(void); +GRN_API void grn_default_query_logger_set_rotate_threshold_size(long long unsigned int threshold); +GRN_API long long unsigned int grn_default_query_logger_get_rotate_threshold_size(void); #define GRN_QUERY_LOG(ctx, flag, mark, format, ...) do {\ if (grn_query_logger_pass(ctx, flag)) {\ Modified: lib/logger.c (+24 -0) =================================================================== --- lib/logger.c 2015-04-17 18:09:59 +0900 (fd5cf64) +++ lib/logger.c 2015-04-17 18:23:37 +0900 (5232b60) @@ -181,6 +181,18 @@ grn_default_logger_get_path(void) } void +grn_default_logger_set_rotate_threshold_size(long long unsigned int threshold) +{ + default_logger_rotate_threshold_size = threshold; +} + +long long unsigned int +grn_default_logger_get_rotate_threshold_size(void) +{ + return default_logger_rotate_threshold_size; +} + +void grn_logger_reopen(grn_ctx *ctx) { if (current_logger.reopen) { @@ -446,6 +458,18 @@ grn_default_query_logger_get_path(void) } void +grn_default_query_logger_set_rotate_threshold_size(long long unsigned int threshold) +{ + default_query_logger_rotate_threshold_size = threshold; +} + +long long unsigned int +grn_default_query_logger_get_rotate_threshold_size(void) +{ + return default_query_logger_rotate_threshold_size; +} + +void grn_query_logger_reopen(grn_ctx *ctx) { if (current_query_logger.reopen) { -------------- next part -------------- HTML����������������������������... Download