| 1 | /* -*- c-basic-offset: 2 -*- */cxx . . $ `<file>/storage/mroonga/vendor/groonga/lib/logger.c`/ |
| 2 | /* |
| 3 | Copyright(C) 2009-2017 Brazil |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License version 2.1 as published by the Free Software Foundation. |
| 8 | |
| 9 | This library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with this library; if not, write to the Free Software |
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA |
| 17 | */ |
| 18 | |
| 19 | #include "grn_logger.h"cxx . . $ `<file>/storage/mroonga/vendor/groonga/lib/grn_logger.h`/ |
| 20 | #include "grn_ctx.h"cxx . . $ `<file>/storage/mroonga/vendor/groonga/lib/grn_ctx.h`/ |
| 21 | #include "grn_ctx_impl.h"cxx . . $ `<file>/storage/mroonga/vendor/groonga/lib/grn_ctx_impl.h`/ |
| 22 | |
| 23 | #include <stdio.h> |
| 24 | #include <string.h> |
| 25 | #include <sys/stat.h> |
| 26 | |
| 27 | #ifdef WIN32 |
| 28 | # include <share.h> |
| 29 | #endif /* WIN32 */ |
| 30 | |
| 31 | static const char *log_level_namescxx . . $ log_level_names.[] = { |
| 32 | "none", |
| 33 | "emergency", |
| 34 | "alert", |
| 35 | "critical", |
| 36 | "error", |
| 37 | "warning", |
| 38 | "notice", |
| 39 | "info", |
| 40 | "debug", |
| 41 | "dump" |
| 42 | }; |
| 43 | |
| 44 | #define GRN_LOG_LASTcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:44:9`! GRN_LOG_DUMP |
| 45 | |
| 46 | const char * |
| 47 | grn_log_level_to_stringcxx . . $ grn_log_level_to_string(e273248267cc0d14).(grn_log_levelcxx . . $ grn_log_level# level) |
| 48 | { |
| 49 | if (level <= GRN_LOG_LASTcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:44:9`!) { |
| 50 | return log_level_namescxx . . $ log_level_names.[level]; |
| 51 | } else { |
| 52 | return "unknown"; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | grn_boolcxx . . $ grn_bool# |
| 57 | grn_log_level_parsecxx . . $ grn_log_level_parse(96c66f45e0e73ef).(const char *string, grn_log_levelcxx . . $ grn_log_level# *level) |
| 58 | { |
| 59 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(string, " ") == 0 || |
| 60 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "none") == 0) { |
| 61 | *level = GRN_LOG_NONEcxx . . $ GRN_LOG_NONE.; |
| 62 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 63 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(string, "E") == 0 || |
| 64 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "emerg") == 0 || |
| 65 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "emergency") == 0) { |
| 66 | *level = GRN_LOG_EMERGcxx . . $ GRN_LOG_EMERG.; |
| 67 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 68 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(string, "A") == 0 || |
| 69 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "alert") == 0) { |
| 70 | *level = GRN_LOG_ALERTcxx . . $ GRN_LOG_ALERT.; |
| 71 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 72 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(string, "C") == 0 || |
| 73 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "crit") == 0 || |
| 74 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "critical") == 0) { |
| 75 | *level = GRN_LOG_CRITcxx . . $ GRN_LOG_CRIT.; |
| 76 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 77 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(string, "e") == 0 || |
| 78 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "error") == 0) { |
| 79 | *level = GRN_LOG_ERRORcxx . . $ GRN_LOG_ERROR.; |
| 80 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 81 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(string, "w") == 0 || |
| 82 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "warn") == 0 || |
| 83 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "warning") == 0) { |
| 84 | *level = GRN_LOG_WARNINGcxx . . $ GRN_LOG_WARNING.; |
| 85 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 86 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(string, "n") == 0 || |
| 87 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "notice") == 0) { |
| 88 | *level = GRN_LOG_NOTICEcxx . . $ GRN_LOG_NOTICE.; |
| 89 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 90 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(string, "i") == 0 || |
| 91 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "info") == 0) { |
| 92 | *level = GRN_LOG_INFOcxx . . $ GRN_LOG_INFO.; |
| 93 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 94 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(string, "d") == 0 || |
| 95 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "debug") == 0) { |
| 96 | *level = GRN_LOG_DEBUGcxx . . $ GRN_LOG_DEBUG.; |
| 97 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 98 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(string, "-") == 0 || |
| 99 | grn_strcasecmpcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:124:10`!(string, "dump") == 0) { |
| 100 | *level = GRN_LOG_DUMPcxx . . $ GRN_LOG_DUMP.; |
| 101 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 102 | } else { |
| 103 | return GRN_FALSEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:45:9`!; |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | static void |
| 108 | rotate_log_filecxx . . $ rotate_log_file(777524e3d10dd7b4).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *current_path) |
| 109 | { |
| 110 | char rotated_path[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!]; |
| 111 | grn_timevalcxx . . $ grn_timeval# now; |
| 112 | struct tmcxx . . $ tm# tm_buffer; |
| 113 | struct tmcxx . . $ tm# *tm; |
| 114 | |
| 115 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &now); |
| 116 | tm = grn_timeval2tmcxx . . $ grn_timeval2tm(17aa9e83661c23e4).(ctx, &now, &tm_buffer); |
| 117 | grn_snprintfcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:141:10`!(rotated_path, PATH_MAX, PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!, |
| 118 | "%s.%04d-%02d-%02d-%02d-%02d-%02d-%06d", |
| 119 | current_path, |
| 120 | tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, |
| 121 | tm->tm_hour, tm->tm_min, tm->tm_sec, |
| 122 | (int)(GRN_TIME_NSEC_TO_USECcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/time.h:36:9`!(now.tv_nsec))); |
| 123 | renamecxx . . $ rename(5ae29d726ae57f88).(current_path, rotated_path); |
| 124 | } |
| 125 | |
| 126 | static grn_boolcxx . . $ grn_bool# logger_initedcxx . . $ logger_inited. = GRN_FALSEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:45:9`!; |
| 127 | static char *default_logger_pathcxx . . $ default_logger_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 128 | static FILEcxx . . $ FILE# *default_logger_filecxx . . $ default_logger_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 129 | static grn_critical_sectioncxx . . $ grn_critical_section# default_logger_lockcxx . . $ default_logger_lock.; |
| 130 | static off_tcxx . . $ off_t# default_logger_sizecxx . . $ default_logger_size. = 0; |
| 131 | static off_tcxx . . $ off_t# default_logger_rotate_threshold_sizecxx . . $ default_logger_rotate_threshold_size. = 0; |
| 132 | |
| 133 | #define LOGGER_NEED_ROTATEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:133:9`!(size, threshold) \ |
| 134 | ((threshold) > 0 && (size) >= (threshold)) |
| 135 | |
| 136 | static void |
| 137 | default_logger_logcxx . . $ default_logger_log(4382505f96719c86).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_log_levelcxx . . $ grn_log_level# level, |
| 138 | const char *timestamp, const char *title, |
| 139 | const char *message, const char *location, void *user_data) |
| 140 | { |
| 141 | const char slev[] = " EACewnid-"; |
| 142 | if (default_logger_pathcxx . . $ default_logger_path.) { |
| 143 | CRITICAL_SECTION_ENTERcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:235:10`!(default_logger_lock); |
| 144 | if (!default_logger_filecxx . . $ default_logger_file.) { |
| 145 | default_logger_filecxx . . $ default_logger_file. = grn_fopencxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:73:10`!(default_logger_path, "a"); |
| 146 | default_logger_sizecxx . . $ default_logger_size. = 0; |
| 147 | if (default_logger_filecxx . . $ default_logger_file.) { |
| 148 | struct statcxx . . $ stat# stat; |
| 149 | if (fstatcxx . . $ fstat(a43660ce2f600cb5).(grn_filenocxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:188:10`!(default_logger_file), &stat) != -1) { |
| 150 | default_logger_sizecxx . . $ default_logger_size. = stat.st_sizecxx . . $ stat#st_size.; |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | if (default_logger_filecxx . . $ default_logger_file.) { |
| 155 | char label = *(slev + level); |
| 156 | int written; |
| 157 | if (location && *location) { |
| 158 | if (title && *title) { |
| 159 | written = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(default_logger_filecxx . . $ default_logger_file., "%s|%c|%s: %s %s\n", |
| 160 | timestamp, label, location, title, message); |
| 161 | } else { |
| 162 | written = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(default_logger_filecxx . . $ default_logger_file., "%s|%c|%s: %s\n", |
| 163 | timestamp, label, location, message); |
| 164 | } |
| 165 | } else { |
| 166 | written = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(default_logger_filecxx . . $ default_logger_file., "%s|%c|%s %s\n", |
| 167 | timestamp, label, title, message); |
| 168 | } |
| 169 | if (written > 0) { |
| 170 | default_logger_sizecxx . . $ default_logger_size. += written; |
| 171 | if (LOGGER_NEED_ROTATEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:133:9`!(default_logger_size, |
| 172 | default_logger_rotate_threshold_size)) { |
| 173 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(default_logger_filecxx . . $ default_logger_file.); |
| 174 | default_logger_filecxx . . $ default_logger_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 175 | rotate_log_filecxx . . $ rotate_log_file(777524e3d10dd7b4).(ctx, default_logger_pathcxx . . $ default_logger_path.); |
| 176 | } else { |
| 177 | fflushcxx . . $ fflush(89bc1efcdac0ca22).(default_logger_filecxx . . $ default_logger_file.); |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | CRITICAL_SECTION_LEAVEcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:236:10`!(default_logger_lock); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | static void |
| 186 | default_logger_reopencxx . . $ default_logger_reopen(b6b6153f622d9caa).(grn_ctxcxx . . $ grn_ctx# *ctx, void *user_data) |
| 187 | { |
| 188 | GRN_LOGcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1112:9`!(ctx, GRN_LOG_NOTICE, "log will be closed."); |
| 189 | CRITICAL_SECTION_ENTERcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:235:10`!(default_logger_lock); |
| 190 | if (default_logger_filecxx . . $ default_logger_file.) { |
| 191 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(default_logger_filecxx . . $ default_logger_file.); |
| 192 | default_logger_filecxx . . $ default_logger_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 193 | } |
| 194 | CRITICAL_SECTION_LEAVEcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:236:10`!(default_logger_lock); |
| 195 | GRN_LOGcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1112:9`!(ctx, GRN_LOG_NOTICE, "log opened."); |
| 196 | } |
| 197 | |
| 198 | static void |
| 199 | default_logger_fincxx . . $ default_logger_fin(b6b6153f622d9caa).(grn_ctxcxx . . $ grn_ctx# *ctx, void *user_data) |
| 200 | { |
| 201 | CRITICAL_SECTION_ENTERcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:235:10`!(default_logger_lock); |
| 202 | if (default_logger_filecxx . . $ default_logger_file.) { |
| 203 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(default_logger_filecxx . . $ default_logger_file.); |
| 204 | default_logger_filecxx . . $ default_logger_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 205 | } |
| 206 | CRITICAL_SECTION_LEAVEcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:236:10`!(default_logger_lock); |
| 207 | } |
| 208 | |
| 209 | static grn_loggercxx . . $ grn_logger# default_loggercxx . . $ default_logger. = { |
| 210 | GRN_LOG_DEFAULT_LEVELcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1100:10`!, |
| 211 | GRN_LOG_TIMEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1022:9`!|GRN_LOG_MESSAGEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1024:9`!, |
| 212 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 213 | default_logger_logcxx . . $ default_logger_log(4382505f96719c86)., |
| 214 | default_logger_reopencxx . . $ default_logger_reopen(b6b6153f622d9caa)., |
| 215 | default_logger_fincxx . . $ default_logger_fin(b6b6153f622d9caa). |
| 216 | }; |
| 217 | |
| 218 | #define INITIAL_LOGGERcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:218:9`! { \ |
| 219 | GRN_LOG_DEFAULT_LEVELcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1100:10`!, \ |
| 220 | GRN_LOG_TIMEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1022:9`!|GRN_LOG_MESSAGEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1024:9`!, \ |
| 221 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, \ |
| 222 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, \ |
| 223 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, \ |
| 224 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! \ |
| 225 | } |
| 226 | |
| 227 | static grn_loggercxx . . $ grn_logger# current_loggercxx . . $ current_logger. = INITIAL_LOGGERcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:218:9`!; |
| 228 | |
| 229 | void |
| 230 | grn_default_logger_set_max_levelcxx . . $ grn_default_logger_set_max_level(f9d277a447c2c34d).(grn_log_levelcxx . . $ grn_log_level# max_level) |
| 231 | { |
| 232 | default_loggercxx . . $ default_logger..max_levelcxx . . $ _grn_logger#max_level. = max_level; |
| 233 | if (current_loggercxx . . $ current_logger..logcxx . . $ _grn_logger#log. == default_logger_logcxx . . $ default_logger_log(4382505f96719c86).) { |
| 234 | current_loggercxx . . $ current_logger..max_levelcxx . . $ _grn_logger#max_level. = max_level; |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | grn_log_levelcxx . . $ grn_log_level# |
| 239 | grn_default_logger_get_max_levelcxx . . $ grn_default_logger_get_max_level(992d95faad553eb).(void) |
| 240 | { |
| 241 | return default_loggercxx . . $ default_logger..max_levelcxx . . $ _grn_logger#max_level.; |
| 242 | } |
| 243 | |
| 244 | void |
| 245 | grn_default_logger_set_flagscxx . . $ grn_default_logger_set_flags(d4f767463ce0a6b3).(int flags) |
| 246 | { |
| 247 | default_loggercxx . . $ default_logger..flagscxx . . $ _grn_logger#flags. = flags; |
| 248 | if (current_loggercxx . . $ current_logger..logcxx . . $ _grn_logger#log. == default_logger_logcxx . . $ default_logger_log(4382505f96719c86).) { |
| 249 | current_loggercxx . . $ current_logger..flagscxx . . $ _grn_logger#flags. = flags; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | int |
| 254 | grn_default_logger_get_flagscxx . . $ grn_default_logger_get_flags(b126dc7c1de90089).(void) |
| 255 | { |
| 256 | return default_loggercxx . . $ default_logger..flagscxx . . $ _grn_logger#flags.; |
| 257 | } |
| 258 | |
| 259 | void |
| 260 | grn_default_logger_set_pathcxx . . $ grn_default_logger_set_path(85c52e162fed56f9).(const char *path) |
| 261 | { |
| 262 | if (logger_initedcxx . . $ logger_inited.) { |
| 263 | CRITICAL_SECTION_ENTERcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:235:10`!(default_logger_lock); |
| 264 | } |
| 265 | |
| 266 | if (default_logger_pathcxx . . $ default_logger_path.) { |
| 267 | freecxx . . $ free(5d22bdacc48458e8).(default_logger_pathcxx . . $ default_logger_path.); |
| 268 | } |
| 269 | |
| 270 | if (path) { |
| 271 | default_logger_pathcxx . . $ default_logger_path. = grn_strdup_rawcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:79:10`!(path); |
| 272 | } else { |
| 273 | default_logger_pathcxx . . $ default_logger_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 274 | } |
| 275 | |
| 276 | if (logger_initedcxx . . $ logger_inited.) { |
| 277 | CRITICAL_SECTION_LEAVEcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:236:10`!(default_logger_lock); |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | const char * |
| 282 | grn_default_logger_get_pathcxx . . $ grn_default_logger_get_path(33a1f659e94feb42).(void) |
| 283 | { |
| 284 | return default_logger_pathcxx . . $ default_logger_path.; |
| 285 | } |
| 286 | |
| 287 | void |
| 288 | grn_default_logger_set_rotate_threshold_sizecxx . . $ grn_default_logger_set_rotate_threshold_size(1624ee8275b10bda).(off_tcxx . . $ off_t# threshold) |
| 289 | { |
| 290 | default_logger_rotate_threshold_sizecxx . . $ default_logger_rotate_threshold_size. = threshold; |
| 291 | } |
| 292 | |
| 293 | off_tcxx . . $ off_t# |
| 294 | grn_default_logger_get_rotate_threshold_sizecxx . . $ grn_default_logger_get_rotate_threshold_size(da6335ded91d79c2).(void) |
| 295 | { |
| 296 | return default_logger_rotate_threshold_sizecxx . . $ default_logger_rotate_threshold_size.; |
| 297 | } |
| 298 | |
| 299 | void |
| 300 | grn_logger_reopencxx . . $ grn_logger_reopen(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 301 | { |
| 302 | if (current_loggercxx . . $ current_logger..reopencxx . . $ _grn_logger#reopen.) { |
| 303 | current_loggercxx . . $ current_logger..reopencxx . . $ _grn_logger#reopen.(ctx, current_loggercxx . . $ current_logger..user_datacxx . . $ _grn_logger#user_data.); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | static void |
| 308 | current_logger_fincxx . . $ current_logger_fin(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 309 | { |
| 310 | if (current_loggercxx . . $ current_logger..fincxx . . $ _grn_logger#fin.) { |
| 311 | current_loggercxx . . $ current_logger..fincxx . . $ _grn_logger#fin.(ctx, current_loggercxx . . $ current_logger..user_datacxx . . $ _grn_logger#user_data.); |
| 312 | } |
| 313 | { |
| 314 | grn_loggercxx . . $ grn_logger# initial_logger = INITIAL_LOGGERcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:218:9`!; |
| 315 | current_loggercxx . . $ current_logger. = initial_logger; |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | static void |
| 320 | logger_info_func_wrappercxx . . $ logger_info_func_wrapper(4382505f96719c86).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_log_levelcxx . . $ grn_log_level# level, |
| 321 | const char *timestamp, const char *title, |
| 322 | const char *message, const char *location, |
| 323 | void *user_data) |
| 324 | { |
| 325 | grn_logger_infocxx . . $ grn_logger_info# *info = user_data; |
| 326 | info->funccxx . . $ _grn_logger_info#func.(level, timestamp, title, message, location, info->func_argcxx . . $ _grn_logger_info#func_arg.); |
| 327 | } |
| 328 | |
| 329 | /* Deprecated since 2.1.2. */ |
| 330 | grn_rccxx . . $ grn_rc# |
| 331 | grn_logger_info_setcxx . . $ grn_logger_info_set(6292ecf3a1ef3543).(grn_ctxcxx . . $ grn_ctx# *ctx, const grn_logger_infocxx . . $ grn_logger_info# *info) |
| 332 | { |
| 333 | if (info) { |
| 334 | grn_loggercxx . . $ grn_logger# logger; |
| 335 | |
| 336 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&logger, 0, sizeof(grn_loggercxx . . $ grn_logger#)); |
| 337 | logger.max_levelcxx . . $ _grn_logger#max_level. = info->max_levelcxx . . $ _grn_logger_info#max_level.; |
| 338 | logger.flagscxx . . $ _grn_logger#flags. = info->flagscxx . . $ _grn_logger_info#flags.; |
| 339 | if (info->funccxx . . $ _grn_logger_info#func.) { |
| 340 | logger.logcxx . . $ _grn_logger#log. = logger_info_func_wrappercxx . . $ logger_info_func_wrapper(4382505f96719c86).; |
| 341 | logger.user_datacxx . . $ _grn_logger#user_data. = (grn_logger_infocxx . . $ grn_logger_info# *)info; |
| 342 | } else { |
| 343 | logger.logcxx . . $ _grn_logger#log. = default_logger_logcxx . . $ default_logger_log(4382505f96719c86).; |
| 344 | logger.reopencxx . . $ _grn_logger#reopen. = default_logger_reopencxx . . $ default_logger_reopen(b6b6153f622d9caa).; |
| 345 | logger.fincxx . . $ _grn_logger#fin. = default_logger_fincxx . . $ default_logger_fin(b6b6153f622d9caa).; |
| 346 | } |
| 347 | return grn_logger_setcxx . . $ grn_logger_set(937c97a7242c3be2).(ctx, &logger); |
| 348 | } else { |
| 349 | return grn_logger_setcxx . . $ grn_logger_set(937c97a7242c3be2).(ctx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | grn_rccxx . . $ grn_rc# |
| 354 | grn_logger_setcxx . . $ grn_logger_set(937c97a7242c3be2).(grn_ctxcxx . . $ grn_ctx# *ctx, const grn_loggercxx . . $ grn_logger# *logger) |
| 355 | { |
| 356 | current_logger_fincxx . . $ current_logger_fin(b578cd6e53d5fe91).(ctx); |
| 357 | if (logger) { |
| 358 | current_loggercxx . . $ current_logger. = *logger; |
| 359 | } else { |
| 360 | current_loggercxx . . $ current_logger. = default_loggercxx . . $ default_logger.; |
| 361 | } |
| 362 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 363 | } |
| 364 | |
| 365 | void |
| 366 | grn_logger_set_max_levelcxx . . $ grn_logger_set_max_level(59adfd980b109eb9).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_log_levelcxx . . $ grn_log_level# max_level) |
| 367 | { |
| 368 | current_loggercxx . . $ current_logger..max_levelcxx . . $ _grn_logger#max_level. = max_level; |
| 369 | } |
| 370 | |
| 371 | grn_log_levelcxx . . $ grn_log_level# |
| 372 | grn_logger_get_max_levelcxx . . $ grn_logger_get_max_level(24044f8444e1c9ec).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 373 | { |
| 374 | return current_loggercxx . . $ current_logger..max_levelcxx . . $ _grn_logger#max_level.; |
| 375 | } |
| 376 | |
| 377 | grn_boolcxx . . $ grn_bool# |
| 378 | grn_logger_passcxx . . $ grn_logger_pass(8db28701856bf50b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_log_levelcxx . . $ grn_log_level# level) |
| 379 | { |
| 380 | return level <= current_loggercxx . . $ current_logger..max_levelcxx . . $ _grn_logger#max_level.; |
| 381 | } |
| 382 | |
| 383 | #define TBUFSIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:383:9`! GRN_TIMEVAL_STR_SIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/grn_time.h:28:9`! |
| 384 | #define MBUFSIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:384:9`! 0x1000 |
| 385 | #define LBUFSIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:385:9`! 0x400 |
| 386 | |
| 387 | void |
| 388 | grn_logger_putcxx . . $ grn_logger_put(d93ace076242abaa).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 389 | grn_log_levelcxx . . $ grn_log_level# level, |
| 390 | const char *file, |
| 391 | int line, |
| 392 | const char *func, |
| 393 | const char *fmt, |
| 394 | ...) |
| 395 | { |
| 396 | va_listcxx . . $ va_list# ap; |
| 397 | va_startcxx . . $ `<external>/8105065126723003039/stdarg.h:50:9`!(ap, fmt); |
| 398 | grn_logger_putvcxx . . $ grn_logger_putv(76508e69ff1adf9d).(ctx, level, file, line, func, fmt, ap); |
| 399 | va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`!(ap); |
| 400 | } |
| 401 | |
| 402 | void |
| 403 | grn_logger_putvcxx . . $ grn_logger_putv(76508e69ff1adf9d).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 404 | grn_log_levelcxx . . $ grn_log_level# level, |
| 405 | const char *file, |
| 406 | int line, |
| 407 | const char *func, |
| 408 | const char *fmt, |
| 409 | va_listcxx . . $ va_list# ap) |
| 410 | { |
| 411 | if (level <= current_loggercxx . . $ current_logger..max_levelcxx . . $ _grn_logger#max_level. && current_loggercxx . . $ current_logger..logcxx . . $ _grn_logger#log.) { |
| 412 | char tbuf[TBUFSIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:383:9`!]; |
| 413 | char mbuf[MBUFSIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:384:9`!]; |
| 414 | char lbuf[LBUFSIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:385:9`!]; |
| 415 | tbuf[0] = '\0'; |
| 416 | if (current_loggercxx . . $ current_logger..flagscxx . . $ _grn_logger#flags. & GRN_LOG_TIMEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1022:9`!) { |
| 417 | grn_timevalcxx . . $ grn_timeval# tv; |
| 418 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 419 | grn_timeval2strcxx . . $ grn_timeval2str(52f9bd5a37f66b1d).(ctx, &tv, tbuf, TBUFSIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:383:9`!); |
| 420 | } |
| 421 | if (current_loggercxx . . $ current_logger..flagscxx . . $ _grn_logger#flags. & GRN_LOG_MESSAGEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1024:9`!) { |
| 422 | grn_vsnprintfcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:151:10`!(mbuf, MBUFSIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:384:9`!, fmt, ap); |
| 423 | } else { |
| 424 | mbuf[0] = '\0'; |
| 425 | } |
| 426 | if (current_loggercxx . . $ current_logger..flagscxx . . $ _grn_logger#flags. & GRN_LOG_LOCATIONcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1025:9`!) { |
| 427 | grn_snprintfcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:141:10`!(lbuf, LBUFSIZE, LBUFSIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:385:9`!, |
| 428 | "%d %s:%d %s()", grn_getpidcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:200:10`!(), file, line, func); |
| 429 | } else if (current_loggercxx . . $ current_logger..flagscxx . . $ _grn_logger#flags. & GRN_LOG_PIDcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1026:9`!) { |
| 430 | grn_snprintfcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:141:10`!(lbuf, LBUFSIZE, LBUFSIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:385:9`!, |
| 431 | "%d", grn_getpidcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:200:10`!()); |
| 432 | } else { |
| 433 | lbuf[0] = '\0'; |
| 434 | } |
| 435 | current_loggercxx . . $ current_logger..logcxx . . $ _grn_logger#log.(ctx, level, tbuf, "", mbuf, lbuf, |
| 436 | current_loggercxx . . $ current_logger..user_datacxx . . $ _grn_logger#user_data.); |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | void |
| 441 | grn_logger_initcxx . . $ grn_logger_init(49f6e7a06ebc5aa8).(void) |
| 442 | { |
| 443 | CRITICAL_SECTION_INITcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:234:10`!(default_logger_lock); |
| 444 | if (!current_loggercxx . . $ current_logger..logcxx . . $ _grn_logger#log.) { |
| 445 | current_loggercxx . . $ current_logger. = default_loggercxx . . $ default_logger.; |
| 446 | } |
| 447 | |
| 448 | logger_initedcxx . . $ logger_inited. = GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 449 | } |
| 450 | |
| 451 | void |
| 452 | grn_logger_fincxx . . $ grn_logger_fin(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 453 | { |
| 454 | current_logger_fincxx . . $ current_logger_fin(b578cd6e53d5fe91).(ctx); |
| 455 | if (default_logger_pathcxx . . $ default_logger_path.) { |
| 456 | freecxx . . $ free(5d22bdacc48458e8).(default_logger_pathcxx . . $ default_logger_path.); |
| 457 | default_logger_pathcxx . . $ default_logger_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 458 | } |
| 459 | CRITICAL_SECTION_FINcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:237:10`!(default_logger_lock); |
| 460 | |
| 461 | logger_initedcxx . . $ logger_inited. = GRN_FALSEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:45:9`!; |
| 462 | } |
| 463 | |
| 464 | |
| 465 | static grn_boolcxx . . $ grn_bool# query_logger_initedcxx . . $ query_logger_inited. = GRN_FALSEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:45:9`!; |
| 466 | static char *default_query_logger_pathcxx . . $ default_query_logger_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 467 | static FILEcxx . . $ FILE# *default_query_logger_filecxx . . $ default_query_logger_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 468 | static grn_critical_sectioncxx . . $ grn_critical_section# default_query_logger_lockcxx . . $ default_query_logger_lock.; |
| 469 | static off_tcxx . . $ off_t# default_query_logger_sizecxx . . $ default_query_logger_size. = 0; |
| 470 | static off_tcxx . . $ off_t# default_query_logger_rotate_threshold_sizecxx . . $ default_query_logger_rotate_threshold_size. = 0; |
| 471 | |
| 472 | grn_boolcxx . . $ grn_bool# |
| 473 | grn_query_log_flags_parsecxx . . $ grn_query_log_flags_parse(6378956565d16f4b).(const char *string, |
| 474 | int string_size, |
| 475 | unsigned int *flags) |
| 476 | { |
| 477 | const char *string_end; |
| 478 | |
| 479 | *flags = GRN_QUERY_LOG_NONEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:176:9`!; |
| 480 | |
| 481 | if (!string) { |
| 482 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 483 | } |
| 484 | |
| 485 | if (string_size < 0) { |
| 486 | string_size = strlencxx . . $ strlen(751346f8406fd082).(string); |
| 487 | } |
| 488 | |
| 489 | string_end = string + string_size; |
| 490 | |
| 491 | while (string < string_end) { |
| 492 | if (*string == '|' || *string == ' ') { |
| 493 | string += 1; |
| 494 | continue; |
| 495 | } |
| 496 | |
| 497 | #define CHECK_FLAGcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:497:9`!(name) \ |
| 498 | if (((size_t) (string_end - string) >= (sizeof(#name) - 1)) && \ |
| 499 | (memcmp(string, #name, sizeof(#name) - 1) == 0) && \ |
| 500 | (((size_t)(string_end - string) == (sizeof(#name) - 1)) || \ |
| 501 | (string[sizeof(#name) - 1] == '|') || \ |
| 502 | (string[sizeof(#name) - 1] == ' '))) { \ |
| 503 | *flags |= GRN_QUERY_LOG_ ## name; \ |
| 504 | string += sizeof(#name) - 1; \ |
| 505 | continue; \ |
| 506 | } |
| 507 | |
| 508 | CHECK_FLAGcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:497:9`!(NONE); |
| 509 | CHECK_FLAGcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:497:9`!(COMMAND); |
| 510 | CHECK_FLAGcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:497:9`!(RESULT_CODE); |
| 511 | CHECK_FLAGcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:497:9`!(DESTINATION); |
| 512 | CHECK_FLAGcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:497:9`!(CACHE); |
| 513 | CHECK_FLAGcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:497:9`!(SIZE); |
| 514 | CHECK_FLAGcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:497:9`!(SCORE); |
| 515 | CHECK_FLAGcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:497:9`!(ALL); |
| 516 | CHECK_FLAGcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:497:9`!(DEFAULT); |
| 517 | |
| 518 | #undef CHECK_FLAGcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:497:9`! |
| 519 | |
| 520 | return GRN_FALSEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:45:9`!; |
| 521 | } |
| 522 | |
| 523 | return GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 524 | } |
| 525 | |
| 526 | static void |
| 527 | default_query_logger_logcxx . . $ default_query_logger_log(3b670c8c52f923f).(grn_ctxcxx . . $ grn_ctx# *ctx, unsigned int flag, |
| 528 | const char *timestamp, const char *info, |
| 529 | const char *message, void *user_data) |
| 530 | { |
| 531 | if (default_query_logger_pathcxx . . $ default_query_logger_path.) { |
| 532 | CRITICAL_SECTION_ENTERcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:235:10`!(default_query_logger_lock); |
| 533 | if (!default_query_logger_filecxx . . $ default_query_logger_file.) { |
| 534 | default_query_logger_filecxx . . $ default_query_logger_file. = grn_fopencxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:73:10`!(default_query_logger_path, "a"); |
| 535 | default_query_logger_sizecxx . . $ default_query_logger_size. = 0; |
| 536 | if (default_query_logger_filecxx . . $ default_query_logger_file.) { |
| 537 | struct statcxx . . $ stat# stat; |
| 538 | if (fstatcxx . . $ fstat(a43660ce2f600cb5).(grn_filenocxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:188:10`!(default_query_logger_file), &stat) != -1) { |
| 539 | default_query_logger_sizecxx . . $ default_query_logger_size. = stat.st_sizecxx . . $ stat#st_size.; |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | if (default_query_logger_filecxx . . $ default_query_logger_file.) { |
| 544 | int written; |
| 545 | written = fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(default_query_logger_filecxx . . $ default_query_logger_file., "%s|%s%s\n", |
| 546 | timestamp, info, message); |
| 547 | if (written > 0) { |
| 548 | default_query_logger_sizecxx . . $ default_query_logger_size. += written; |
| 549 | if (LOGGER_NEED_ROTATEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:133:9`!(default_query_logger_size, |
| 550 | default_query_logger_rotate_threshold_size)) { |
| 551 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(default_query_logger_filecxx . . $ default_query_logger_file.); |
| 552 | default_query_logger_filecxx . . $ default_query_logger_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 553 | rotate_log_filecxx . . $ rotate_log_file(777524e3d10dd7b4).(ctx, default_query_logger_pathcxx . . $ default_query_logger_path.); |
| 554 | } else { |
| 555 | fflushcxx . . $ fflush(89bc1efcdac0ca22).(default_query_logger_filecxx . . $ default_query_logger_file.); |
| 556 | } |
| 557 | } |
| 558 | } |
| 559 | CRITICAL_SECTION_LEAVEcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:236:10`!(default_query_logger_lock); |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | static void |
| 564 | default_query_logger_closecxx . . $ default_query_logger_close(b6b6153f622d9caa).(grn_ctxcxx . . $ grn_ctx# *ctx, void *user_data) |
| 565 | { |
| 566 | GRN_QUERY_LOGcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1154:9`!(ctx, GRN_QUERY_LOG_DESTINATIONcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:179:9`!, " ", |
| 567 | "query log will be closed: <%s>", default_query_logger_path); |
| 568 | CRITICAL_SECTION_ENTERcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:235:10`!(default_query_logger_lock); |
| 569 | if (default_query_logger_filecxx . . $ default_query_logger_file.) { |
| 570 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(default_query_logger_filecxx . . $ default_query_logger_file.); |
| 571 | default_query_logger_filecxx . . $ default_query_logger_file. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 572 | } |
| 573 | CRITICAL_SECTION_LEAVEcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:236:10`!(default_query_logger_lock); |
| 574 | } |
| 575 | |
| 576 | static void |
| 577 | default_query_logger_reopencxx . . $ default_query_logger_reopen(b6b6153f622d9caa).(grn_ctxcxx . . $ grn_ctx# *ctx, void *user_data) |
| 578 | { |
| 579 | default_query_logger_closecxx . . $ default_query_logger_close(b6b6153f622d9caa).(ctx, user_data); |
| 580 | if (default_query_logger_pathcxx . . $ default_query_logger_path.) { |
| 581 | GRN_QUERY_LOGcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1154:9`!(ctx, GRN_QUERY_LOG_DESTINATIONcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:179:9`!, " ", |
| 582 | "query log is opened: <%s>", default_query_logger_path); |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | static void |
| 587 | default_query_logger_fincxx . . $ default_query_logger_fin(b6b6153f622d9caa).(grn_ctxcxx . . $ grn_ctx# *ctx, void *user_data) |
| 588 | { |
| 589 | if (default_query_logger_filecxx . . $ default_query_logger_file.) { |
| 590 | default_query_logger_closecxx . . $ default_query_logger_close(b6b6153f622d9caa).(ctx, user_data); |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | static grn_query_loggercxx . . $ grn_query_logger# default_query_loggercxx . . $ default_query_logger. = { |
| 595 | GRN_QUERY_LOG_DEFAULTcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:190:9`!, |
| 596 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 597 | default_query_logger_logcxx . . $ default_query_logger_log(3b670c8c52f923f)., |
| 598 | default_query_logger_reopencxx . . $ default_query_logger_reopen(b6b6153f622d9caa)., |
| 599 | default_query_logger_fincxx . . $ default_query_logger_fin(b6b6153f622d9caa). |
| 600 | }; |
| 601 | |
| 602 | #define INITIAL_QUERY_LOGGERcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:602:9`! { \ |
| 603 | GRN_QUERY_LOG_DEFAULTcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:190:9`!, \ |
| 604 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, \ |
| 605 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, \ |
| 606 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, \ |
| 607 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! \ |
| 608 | } |
| 609 | |
| 610 | static grn_query_loggercxx . . $ grn_query_logger# current_query_loggercxx . . $ current_query_logger. = INITIAL_QUERY_LOGGERcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:602:9`!; |
| 611 | |
| 612 | void |
| 613 | grn_default_query_logger_set_flagscxx . . $ grn_default_query_logger_set_flags(cb2f890c2fdad230).(unsigned int flags) |
| 614 | { |
| 615 | default_query_loggercxx . . $ default_query_logger..flagscxx . . $ _grn_query_logger#flags. = flags; |
| 616 | if (current_query_loggercxx . . $ current_query_logger..logcxx . . $ _grn_query_logger#log. == default_query_logger_logcxx . . $ default_query_logger_log(3b670c8c52f923f).) { |
| 617 | current_query_loggercxx . . $ current_query_logger..flagscxx . . $ _grn_query_logger#flags. = flags; |
| 618 | } |
| 619 | } |
| 620 | |
| 621 | unsigned int |
| 622 | grn_default_query_logger_get_flagscxx . . $ grn_default_query_logger_get_flags(db52760e79bf9054).(void) |
| 623 | { |
| 624 | return default_query_loggercxx . . $ default_query_logger..flagscxx . . $ _grn_query_logger#flags.; |
| 625 | } |
| 626 | |
| 627 | void |
| 628 | grn_default_query_logger_set_pathcxx . . $ grn_default_query_logger_set_path(85c52e162fed56f9).(const char *path) |
| 629 | { |
| 630 | if (query_logger_initedcxx . . $ query_logger_inited.) { |
| 631 | CRITICAL_SECTION_ENTERcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:235:10`!(default_query_logger_lock); |
| 632 | } |
| 633 | |
| 634 | if (default_query_logger_pathcxx . . $ default_query_logger_path.) { |
| 635 | freecxx . . $ free(5d22bdacc48458e8).(default_query_logger_pathcxx . . $ default_query_logger_path.); |
| 636 | } |
| 637 | |
| 638 | if (path) { |
| 639 | default_query_logger_pathcxx . . $ default_query_logger_path. = grn_strdup_rawcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:79:10`!(path); |
| 640 | } else { |
| 641 | default_query_logger_pathcxx . . $ default_query_logger_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 642 | } |
| 643 | |
| 644 | if (query_logger_initedcxx . . $ query_logger_inited.) { |
| 645 | CRITICAL_SECTION_LEAVEcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:236:10`!(default_query_logger_lock); |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | const char * |
| 650 | grn_default_query_logger_get_pathcxx . . $ grn_default_query_logger_get_path(33a1f659e94feb42).(void) |
| 651 | { |
| 652 | return default_query_logger_pathcxx . . $ default_query_logger_path.; |
| 653 | } |
| 654 | |
| 655 | void |
| 656 | grn_default_query_logger_set_rotate_threshold_sizecxx . . $ grn_default_query_logger_set_rotate_threshold_size(1624ee8275b10bda).(off_tcxx . . $ off_t# threshold) |
| 657 | { |
| 658 | default_query_logger_rotate_threshold_sizecxx . . $ default_query_logger_rotate_threshold_size. = threshold; |
| 659 | } |
| 660 | |
| 661 | off_tcxx . . $ off_t# |
| 662 | grn_default_query_logger_get_rotate_threshold_sizecxx . . $ grn_default_query_logger_get_rotate_threshold_size(da6335ded91d79c2).(void) |
| 663 | { |
| 664 | return default_query_logger_rotate_threshold_sizecxx . . $ default_query_logger_rotate_threshold_size.; |
| 665 | } |
| 666 | |
| 667 | void |
| 668 | grn_query_logger_reopencxx . . $ grn_query_logger_reopen(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 669 | { |
| 670 | if (current_query_loggercxx . . $ current_query_logger..reopencxx . . $ _grn_query_logger#reopen.) { |
| 671 | current_query_loggercxx . . $ current_query_logger..reopencxx . . $ _grn_query_logger#reopen.(ctx, current_query_loggercxx . . $ current_query_logger..user_datacxx . . $ _grn_query_logger#user_data.); |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | static void |
| 676 | current_query_logger_fincxx . . $ current_query_logger_fin(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 677 | { |
| 678 | if (current_query_loggercxx . . $ current_query_logger..fincxx . . $ _grn_query_logger#fin.) { |
| 679 | current_query_loggercxx . . $ current_query_logger..fincxx . . $ _grn_query_logger#fin.(ctx, current_query_loggercxx . . $ current_query_logger..user_datacxx . . $ _grn_query_logger#user_data.); |
| 680 | } |
| 681 | { |
| 682 | grn_query_loggercxx . . $ grn_query_logger# initial_query_logger = INITIAL_QUERY_LOGGERcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:602:9`!; |
| 683 | current_query_loggercxx . . $ current_query_logger. = initial_query_logger; |
| 684 | } |
| 685 | } |
| 686 | |
| 687 | grn_rccxx . . $ grn_rc# |
| 688 | grn_query_logger_setcxx . . $ grn_query_logger_set(af9cca702b232aeb).(grn_ctxcxx . . $ grn_ctx# *ctx, const grn_query_loggercxx . . $ grn_query_logger# *logger) |
| 689 | { |
| 690 | current_query_logger_fincxx . . $ current_query_logger_fin(b578cd6e53d5fe91).(ctx); |
| 691 | if (logger) { |
| 692 | current_query_loggercxx . . $ current_query_logger. = *logger; |
| 693 | } else { |
| 694 | current_query_loggercxx . . $ current_query_logger. = default_query_loggercxx . . $ default_query_logger.; |
| 695 | } |
| 696 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 697 | } |
| 698 | |
| 699 | void |
| 700 | grn_query_logger_set_flagscxx . . $ grn_query_logger_set_flags(969b9cdb234920c4).(grn_ctxcxx . . $ grn_ctx# *ctx, unsigned int flags) |
| 701 | { |
| 702 | current_query_loggercxx . . $ current_query_logger..flagscxx . . $ _grn_query_logger#flags. = flags; |
| 703 | } |
| 704 | |
| 705 | void |
| 706 | grn_query_logger_add_flagscxx . . $ grn_query_logger_add_flags(969b9cdb234920c4).(grn_ctxcxx . . $ grn_ctx# *ctx, unsigned int flags) |
| 707 | { |
| 708 | current_query_loggercxx . . $ current_query_logger..flagscxx . . $ _grn_query_logger#flags. |= flags; |
| 709 | } |
| 710 | |
| 711 | void |
| 712 | grn_query_logger_remove_flagscxx . . $ grn_query_logger_remove_flags(969b9cdb234920c4).(grn_ctxcxx . . $ grn_ctx# *ctx, unsigned int flags) |
| 713 | { |
| 714 | current_query_loggercxx . . $ current_query_logger..flagscxx . . $ _grn_query_logger#flags. &= ~flags; |
| 715 | } |
| 716 | |
| 717 | unsigned int |
| 718 | grn_query_logger_get_flagscxx . . $ grn_query_logger_get_flags(42892115b099e3b9).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 719 | { |
| 720 | return current_query_loggercxx . . $ current_query_logger..flagscxx . . $ _grn_query_logger#flags.; |
| 721 | } |
| 722 | |
| 723 | grn_boolcxx . . $ grn_bool# |
| 724 | grn_query_logger_passcxx . . $ grn_query_logger_pass(b0783d5382ad72f4).(grn_ctxcxx . . $ grn_ctx# *ctx, unsigned int flag) |
| 725 | { |
| 726 | return current_query_loggercxx . . $ current_query_logger..flagscxx . . $ _grn_query_logger#flags. & flag; |
| 727 | } |
| 728 | |
| 729 | #define TIMESTAMP_BUFFER_SIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:729:9`! TBUFSIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:383:9`! |
| 730 | /* 8+a(%p) + 1(|) + 1(mark) + 15(elapsed time) = 25+a */ |
| 731 | #define INFO_BUFFER_SIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:731:9`! 40 |
| 732 | |
| 733 | void |
| 734 | grn_query_logger_putcxx . . $ grn_query_logger_put(7b375168e1a7db49).(grn_ctxcxx . . $ grn_ctx# *ctx, unsigned int flag, const char *mark, |
| 735 | const char *format, ...) |
| 736 | { |
| 737 | char timestamp[TIMESTAMP_BUFFER_SIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:729:9`!]; |
| 738 | char info[INFO_BUFFER_SIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:731:9`!]; |
| 739 | grn_objcxx . . $ grn_obj# *message = &ctx->implcxx . . $ _grn_ctx#impl.->query_log_bufcxx . . $ _grn_ctx_impl#query_log_buf.; |
| 740 | |
| 741 | if (!current_query_loggercxx . . $ current_query_logger..logcxx . . $ _grn_query_logger#log.) { |
| 742 | return; |
| 743 | } |
| 744 | |
| 745 | { |
| 746 | grn_timevalcxx . . $ grn_timeval# tv; |
| 747 | timestamp[0] = '\0'; |
| 748 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 749 | grn_timeval2strcxx . . $ grn_timeval2str(52f9bd5a37f66b1d).(ctx, &tv, timestamp, TIMESTAMP_BUFFER_SIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:729:9`!); |
| 750 | } |
| 751 | |
| 752 | if (flag & (GRN_QUERY_LOG_COMMANDcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:177:9`! | GRN_QUERY_LOG_DESTINATIONcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:179:9`!)) { |
| 753 | grn_snprintfcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:141:10`!(info, INFO_BUFFER_SIZE, INFO_BUFFER_SIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:731:9`!, |
| 754 | "%p|%s", ctx, mark); |
| 755 | info[INFO_BUFFER_SIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:731:9`! - 1] = '\0'; |
| 756 | } else { |
| 757 | grn_timevalcxx . . $ grn_timeval# tv; |
| 758 | uint64_tcxx . . $ uint64_t# elapsed_time; |
| 759 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 760 | elapsed_time = |
| 761 | (uint64_tcxx . . $ uint64_t#)(tv.tv_seccxx . . $ $anonymous_type_4745dae97e51c7d5_20#tv_sec. - ctx->implcxx . . $ _grn_ctx#impl.->tvcxx . . $ _grn_ctx_impl#tv..tv_seccxx . . $ $anonymous_type_4745dae97e51c7d5_20#tv_sec.) * GRN_TIME_NSEC_PER_SECcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/time.h:31:9`! + |
| 762 | (tv.tv_nseccxx . . $ $anonymous_type_4745dae97e51c7d5_20#tv_nsec. - ctx->implcxx . . $ _grn_ctx#impl.->tvcxx . . $ _grn_ctx_impl#tv..tv_nseccxx . . $ $anonymous_type_4745dae97e51c7d5_20#tv_nsec.); |
| 763 | |
| 764 | grn_snprintfcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/portability.h:141:10`!(info, INFO_BUFFER_SIZE, INFO_BUFFER_SIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:731:9`!, |
| 765 | "%p|%s%015" GRN_FMT_INT64Ucxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:437:10`! " ", ctx, mark, elapsed_time); |
| 766 | info[INFO_BUFFER_SIZEcxx . . $ `storage/mroonga/vendor/groonga/lib/logger.c:731:9`! - 1] = '\0'; |
| 767 | } |
| 768 | |
| 769 | { |
| 770 | va_listcxx . . $ va_list# args; |
| 771 | |
| 772 | va_startcxx . . $ `<external>/8105065126723003039/stdarg.h:50:9`!(args, format); |
| 773 | GRN_BULK_REWINDcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1167:9`!(message); |
| 774 | grn_text_vprintfcxx . . $ grn_text_vprintf(26ae3e66154406).(ctx, message, format, args); |
| 775 | va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`!(args); |
| 776 | GRN_TEXT_PUTCcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1294:9`!(ctx, message, '\0'); |
| 777 | } |
| 778 | |
| 779 | current_query_loggercxx . . $ current_query_logger..logcxx . . $ _grn_query_logger#log.(ctx, flag, timestamp, info, GRN_TEXT_VALUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1300:9`!(message), |
| 780 | current_query_loggercxx . . $ current_query_logger..user_datacxx . . $ _grn_query_logger#user_data.); |
| 781 | } |
| 782 | |
| 783 | void |
| 784 | grn_query_logger_initcxx . . $ grn_query_logger_init(49f6e7a06ebc5aa8).(void) |
| 785 | { |
| 786 | current_query_loggercxx . . $ current_query_logger. = default_query_loggercxx . . $ default_query_logger.; |
| 787 | CRITICAL_SECTION_INITcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:234:10`!(default_query_logger_lock); |
| 788 | |
| 789 | query_logger_initedcxx . . $ query_logger_inited. = GRN_TRUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:44:9`!; |
| 790 | } |
| 791 | |
| 792 | void |
| 793 | grn_query_logger_fincxx . . $ grn_query_logger_fin(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 794 | { |
| 795 | current_query_logger_fincxx . . $ current_query_logger_fin(b578cd6e53d5fe91).(ctx); |
| 796 | if (default_query_logger_pathcxx . . $ default_query_logger_path.) { |
| 797 | freecxx . . $ free(5d22bdacc48458e8).(default_query_logger_pathcxx . . $ default_query_logger_path.); |
| 798 | default_query_logger_pathcxx . . $ default_query_logger_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 799 | } |
| 800 | CRITICAL_SECTION_FINcxx . . $ `storage/mroonga/vendor/groonga/lib/grn.h:237:10`!(default_query_logger_lock); |
| 801 | |
| 802 | query_logger_initedcxx . . $ query_logger_inited. = GRN_FALSEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:45:9`!; |
| 803 | } |
| 804 | |
| 805 | void |
| 806 | grn_log_reopencxx . . $ grn_log_reopen(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 807 | { |
| 808 | grn_logger_reopencxx . . $ grn_logger_reopen(b578cd6e53d5fe91).(ctx); |
| 809 | grn_query_logger_reopencxx . . $ grn_query_logger_reopen(b578cd6e53d5fe91).(ctx); |
| 810 | } |