| 1 | /* -*- c-basic-offset: 2 -*- */cxx . . $ `<file>/storage/mroonga/vendor/groonga/lib/report.c`/ |
| 2 | /* |
| 3 | Copyright(C) 2015-2016 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_report.h"cxx . . $ `<file>/storage/mroonga/vendor/groonga/lib/grn_report.h`/ |
| 20 | |
| 21 | const grn_log_levelcxx . . $ grn_log_level# GRN_REPORT_INDEX_LOG_LEVELcxx . . $ GRN_REPORT_INDEX_LOG_LEVEL. = GRN_LOG_INFOcxx . . $ GRN_LOG_INFO.; |
| 22 | |
| 23 | void |
| 24 | grn_report_indexcxx . . $ grn_report_index(a946cb14e70570c4).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 25 | const char *action, |
| 26 | const char *tag, |
| 27 | grn_objcxx . . $ grn_obj# *index) |
| 28 | { |
| 29 | char index_name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/table.h:25:9`!]; |
| 30 | int index_name_size; |
| 31 | |
| 32 | if (!grn_logger_passcxx . . $ grn_logger_pass(8db28701856bf50b).(ctx, GRN_REPORT_INDEX_LOG_LEVELcxx . . $ GRN_REPORT_INDEX_LOG_LEVEL.)) { |
| 33 | return; |
| 34 | } |
| 35 | |
| 36 | index_name_size = grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, index, index_name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/table.h:25:9`!); |
| 37 | GRN_LOGcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1112:9`!(ctx, GRN_REPORT_INDEX_LOG_LEVEL, |
| 38 | "%s[index]%s <%.*s>", |
| 39 | action, tag, index_name_size, index_name); |
| 40 | } |
| 41 | |
| 42 | void |
| 43 | grn_report_index_not_usedcxx . . $ grn_report_index_not_used(a1a7a0c1ad554d57).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 44 | const char *action, |
| 45 | const char *tag, |
| 46 | grn_objcxx . . $ grn_obj# *index, |
| 47 | const char *reason) |
| 48 | { |
| 49 | char index_name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/table.h:25:9`!]; |
| 50 | int index_name_size; |
| 51 | |
| 52 | if (!grn_logger_passcxx . . $ grn_logger_pass(8db28701856bf50b).(ctx, GRN_REPORT_INDEX_LOG_LEVELcxx . . $ GRN_REPORT_INDEX_LOG_LEVEL.)) { |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | index_name_size = grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, index, index_name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/table.h:25:9`!); |
| 57 | GRN_LOGcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1112:9`!(ctx, GRN_REPORT_INDEX_LOG_LEVEL, |
| 58 | "%s[index-not-used]%s <%.*s>: %s", |
| 59 | action, tag, index_name_size, index_name, reason); |
| 60 | } |
| 61 | |
| 62 | void |
| 63 | grn_report_tablecxx . . $ grn_report_table(a946cb14e70570c4).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 64 | const char *action, |
| 65 | const char *tag, |
| 66 | grn_objcxx . . $ grn_obj# *table) |
| 67 | { |
| 68 | grn_objcxx . . $ grn_obj# description; |
| 69 | grn_objcxx . . $ grn_obj# *target; |
| 70 | |
| 71 | if (!grn_logger_passcxx . . $ grn_logger_pass(8db28701856bf50b).(ctx, GRN_REPORT_INDEX_LOG_LEVELcxx . . $ GRN_REPORT_INDEX_LOG_LEVEL.)) { |
| 72 | return; |
| 73 | } |
| 74 | |
| 75 | GRN_TEXT_INITcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1275:9`!(&description, 0); |
| 76 | for (target = table; target; target = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, target->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.)) { |
| 77 | char name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/table.h:25:9`!]; |
| 78 | int name_size; |
| 79 | |
| 80 | name_size = grn_obj_namecxx . . $ grn_obj_name(a51d1bff955f2f21).(ctx, target, name, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/table.h:25:9`!); |
| 81 | if (GRN_TEXT_LENcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1301:9`!(&description) > 0) { |
| 82 | GRN_TEXT_PUTScxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1298:9`!(ctx, &description, " -> "); |
| 83 | } |
| 84 | if (name_size == 0) { |
| 85 | GRN_TEXT_PUTScxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1298:9`!(ctx, &description, "(temporary)"); |
| 86 | } else { |
| 87 | GRN_TEXT_PUTScxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1298:9`!(ctx, &description, "<"); |
| 88 | GRN_TEXT_PUTcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1292:9`!(ctx, &description, name, name_size); |
| 89 | GRN_TEXT_PUTScxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1298:9`!(ctx, &description, ">"); |
| 90 | } |
| 91 | } |
| 92 | GRN_LOGcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1112:9`!(ctx, GRN_REPORT_INDEX_LOG_LEVEL, |
| 93 | "%s[table]%s %.*s", |
| 94 | action, tag, |
| 95 | (int)GRN_TEXT_LENcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1301:9`!(&description), |
| 96 | GRN_TEXT_VALUEcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:1300:9`!(&description)); |
| 97 | GRN_OBJ_FINcxx . . $ `storage/mroonga/vendor/groonga/include/groonga/groonga.h:436:9`!(ctx, &description); |
| 98 | } |