File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 8282 'host ' => env ('ELASTICSEARCH_HOST ' , 'http://elasticsearch:9200 ' ),
8383 'index ' => env ('ELASTICSEARCH_INDEX ' , 'encrypted_search ' ),
8484 ],
85+
86+ /*
87+ |--------------------------------------------------------------------------
88+ | Debug Logging
89+ |--------------------------------------------------------------------------
90+ |
91+ | Enable debug logging for encrypted search operations. When enabled,
92+ | the package will log token generation, index updates, and deletions
93+ | to help with debugging and monitoring.
94+ |
95+ | Warning: This can generate a lot of log entries in high-traffic applications.
96+ |
97+ */
98+ 'debug ' => env ('ENCRYPTED_SEARCH_DEBUG ' , false ),
8599];
Original file line number Diff line number Diff line change @@ -126,6 +126,16 @@ public function updateSearchIndex(): void
126126 return ;
127127 }
128128
129+ // Debug logging
130+ if (config ('encrypted-search.debug ' , false )) {
131+ logger ()->debug ('[EncryptedSearch] Updating search index ' , [
132+ 'model ' => static ::class,
133+ 'model_id ' => $ this ->getKey (),
134+ 'token_count ' => count ($ rows ),
135+ 'backend ' => $ useElastic ? 'elasticsearch ' : 'database ' ,
136+ ]);
137+ }
138+
129139 // Choose backend: Elasticsearch or Database
130140 if ($ useElastic ) {
131141 $ this ->syncToElasticsearch ($ rows );
@@ -152,6 +162,15 @@ public function removeSearchIndex(): void
152162 {
153163 $ useElastic = config ('encrypted-search.elasticsearch.enabled ' , false );
154164
165+ // Debug logging
166+ if (config ('encrypted-search.debug ' , false )) {
167+ logger ()->debug ('[EncryptedSearch] Removing search index ' , [
168+ 'model ' => static ::class,
169+ 'model_id ' => $ this ->getKey (),
170+ 'backend ' => $ useElastic ? 'elasticsearch ' : 'database ' ,
171+ ]);
172+ }
173+
155174 if ($ useElastic ) {
156175 $ this ->removeFromElasticsearch ();
157176 } else {
You can’t perform that action at this time.
0 commit comments